Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feat: MsSql support #1610

Open
wants to merge 52 commits into
base: beta
Choose a base branch
from
Open

Conversation

Angelelz
Copy link
Collaborator

@Angelelz Angelelz commented Dec 6, 2023

This PR aims to close #585.

The initial implementation and the first couple of tests are implemented. I will update this description with the status of the implementation.
Initially the only supported driver will be node-mssql.
There is still a lot to do:

  • Driver implementation
  • Core functionality
  • Initial basic CRUD API
  • Initial basic CRUD API integration tests
  • Type tests
  • RQB API
  • Merge support (to do upsert type of functionality)
  • schema integration tests
  • custom types integration tests
  • prefixed integration tests
  • Replica tests
  • relational tests
  • Check (and support) most (all?) mssql data types
  • Add support for $onUpdate
  • Others? ⏳

@AndriiSherman
Copy link
Member

@Angelelz I guess we should not include RQB in first iteration for MSSQL. So it can be another PR scope, same as Merge support (to do upsert type of functionality)

@Irupt
Copy link

Irupt commented Dec 7, 2023

Hello, Thank you for the time you devote to this dialect. I can not wait to see him :)
I looked at some commits, and I wanted to tell you that ntext and text are deprecated and soon deleted: should be replaced by nvarchar(max) varchar(max). These two types are compatible since SQL Server 2012.
Likewise "max" (string) is an acceptable value for "length" of these column types.

@Angelelz
Copy link
Collaborator Author

Angelelz commented Dec 9, 2023

No idea why the tests are not passing. They run well locally. Any idea @dankochetov ?

@Angelelz Angelelz marked this pull request as ready for review December 12, 2023 02:24
@Angelelz
Copy link
Collaborator Author

Some features have been postponed to later PRs, the scope of this one is already huge as it is.
Here are some notable ones:

  • Merge clause (to do upserts)
  • Output clause (similar to returning)
  • Select top similar to limit
  • Recursive CTE ergonomics

@AndriiSherman AndriiSherman self-requested a review December 15, 2023 12:19
@AndriiSherman AndriiSherman changed the base branch from main to beta December 15, 2023 12:19
@GustavoOS
Copy link

It seems this PR has conflicts. Do they have to be resolved before or after the review?

@iaingymware
Copy link

When will this be good to go?

Looking to use Drizzle as our ORM but all DB within the org are MSSQL in Azure.

@phildaniels
Copy link

Can say that as soon as this gets merged, we are immediately migrating from prisma/sequelize at my org!

@iaingymware
Copy link

Looks like this isn't going to get merged any time soon so will have to go with an alternative solution. Unfortunate.

@andreasbhansen
Copy link

Looks like this isn't going to get merged any time soon so will have to go with an alternative solution. Unfortunate.

The issue is listed as in-progress: https://github.com/orgs/drizzle-team/projects/1?pane=issue&itemId=47747581

@mythosmystery
Copy link

Is there any kinda timeline on this getting merged? Would really like to use Drizzle at work but we're stuck on mssql

@scottrupprecht
Copy link

I definitely get the never ending priorities for the team, is there anything we in the community can do to assist in moving this forward? Maybe just the orm functionality released in a beta branch so we can assist in the review while the drizzle kit work is pending? I have manually compiled this PR and tested it extensively over the past few months to much success. I'd have no problem putting money where my mouth is so I'm not asking for something for nothing in return, I'd be happy to bump up my monthly sponsorship or shooting over a one-time payment and I hope others would consider doing so as well to get this functionality into this fine code base.

@lroal

This comment was marked as spam.

@GustavoOS
Copy link

GustavoOS commented May 23, 2024

I definitely get the never ending priorities for the team, is there anything we in the community can do to assist in moving this forward? Maybe just the orm functionality released in a beta branch so we can assist in the review while the drizzle kit work is pending? I have manually compiled this PR and tested it extensively over the past few months to much success. I'd have no problem putting money where my mouth is so I'm not asking for something for nothing in return, I'd be happy to bump up my monthly sponsorship or shooting over a one-time payment and I hope others would consider doing so as well to get this functionality into this fine code base.

@scottrupprecht Maybe this is something you should take to the discord channel: https://discord.gg/tCe773yFeZ

@TG-DylanH
Copy link

My company is starting a new major project soon, and I'd love to use this over Prisma. However, we only use MSSQL. It looks like there hasn't been any progress in ~5 months, could we please get an update on whether this is going to be merged in the near future? 🥺

@andreasbhansen
Copy link

Latest update afaik, found on Discord (permalink):

Andrew Sherman (06/27/2024 12:57 PM): will be done after RLS support, which will be done after generated columns(which I'm pushing to preview release in 1hr and sending discord notification about)

@Aaqu
Copy link

Aaqu commented Sep 2, 2024

RLS info #2450 (comment)

Andrew Sherman (08/29/2024): Update: finishing pull and push logic for policies and roles and preparing for beta release

@Aaqu Aaqu mentioned this pull request Oct 10, 2024
@itpropro
Copy link

itpropro commented Oct 11, 2024

RLS info #2450 (comment)

Andrew Sherman (08/29/2024): Update: finishing pull and push logic for policies and roles and preparing for beta release

This is still not related to MSSQL, please stop referencing that thread.

@andrewchester1
Copy link

Any update on this feature, or a general timeline? The team I am working on is hoping to switch to a newer typescript api framework, but we need mssql support to make this switch. It would be amazing to use drizzle, and hope this feature comes out soon!

@mihaipoenaru
Copy link

I am also starting a project for my company and it would be great if I could just start using drizzle as opposed to making stuff by hand and then going through the pain of porting everything to drizzle.

@tmrclark
Copy link

tmrclark commented Oct 17, 2024

For anybody else who is looking for a good mssql compatible ORM but can't wait for drizzle to add support, my org ended up using kysely and have been very happy with it. It has a companion code gen tool that can introspect types from the database, making setup straightforward.

We initially looked into using drizzle but could not for obvious reasons.

@Angelelz
Copy link
Collaborator Author

The PR has been updated to resolve conflicts and use the new structures/features of the library.
But there is still some work to do: notably, the new syntax to define columns without the database column name is not implemented. @AndriiSherman Should I implement that feature for this PR or you would prefer to include that feature at a later date?

@Gideon-Felt
Copy link

Is no one going to respond to @Angelelz? next steps are needed.

@Aaqu
Copy link

Aaqu commented Dec 23, 2024

Is no one going to respond to @Angelelz? next steps are needed.

In my opinion, they are waiting, hoping that a sponsor might come forward. Right now, it’s not profitable for them.

@Angelelz
Copy link
Collaborator Author

Just to put this out there. This is a 40k+ line PR, and this is only half of what is needed to support mssql. The team will do its best but remember that drizzle-kit support will be needed before this is merged. This PR is only for the ORM side. Mssql requires new syntax to introspect, generate migrations, support the studio, and other drizzle-kit stuff. My understanding is that the team will take care of that part.

@opensas
Copy link

opensas commented Dec 23, 2024

Just to put this out there. This is a 40k+ line PR, and this is only half of what is needed to support mssql. The team will do its best but remember that drizzle-kit support will be needed before this is merged. This PR is only for the ORM side. Mssql requires new syntax to introspect, generate migrations, support the studio, and other drizzle-kit stuff. My understanding is that the team will take care of that part.

great, thanks a lot for all this effort

it would be great to have an issue with the remaining tasks, so we can track it, and it would help everybody understand what's still missing

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE]: MSSQL dialect