Skip to content

Supporting SQL Server in Migration Engine #4074

Closed

Description

@matthewmueller

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: #2430

Activity

  1. added
    kind/feature
    topic: sql server
    on Oct 28, 2020
  2. mattfwood commented on Dec 7, 2020

    @mattfwood

    It looks like this has been merged in the prisma-engines repo, but I imagine it would need to be updated to the latest commit in the prisma repo as well before using this?

  3. pimeys commented on Dec 7, 2020

    @pimeys

    Just wait for tomorrow's release, or install the latest dev version to try this out. The whole migrate platform is changing now, and we'll announce it tomorrow with the docs and all.

  4. pimeys commented on Dec 7, 2020

    @pimeys

    Closing this due to the JavaScript side working with SQL Server now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featuretopic: migratetopic: sql server

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions