Skip to content

Supporting SQL Server in Migration EngineΒ #813

@pimeys

Description

@pimeys

Migration engine should know how to migrate Microsoft SQL Server. Some gotchas:

What string type we use by default?

We can choose from the following string types:

  • varchar would allow us to use UTF-8 encoding, but only on SQL Server 2019. Older versions allow only ASCII characters in this column type.
  • nvarchar is the original column type, allowing other than just the basic ASCII. Uses UCS-2 encoding, meaning instead of Vec<u8> it holds Vec<u16>, doubling the space usage.

Both variants can either be varchar(n) or nvarchar(n), where n is the maximum length of the string. The maximum n for varchar is 8000 and for nvarchar 4000. When having larger strings, one should use the max variants varchar(max)/nvarchar(max), which changes the storage type out from the row and allows maximum of two gigabytes of data.

What binary size we use by default?

  • varbinary(n) where n can be maximum of 8000 bytes. Data stays in the row.
  • varbinary(max) for two gigabytes of storage, data is not kept in the row.

Part of the epic: prisma/prisma#2430

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions