mikro-orm icon indicating copy to clipboard operation
mikro-orm copied to clipboard

Mssql support

Open rubiin opened this issue 4 years ago • 20 comments

I think the orm should include mssql as a supported database type by default instead of doing a custom database setup

rubiin avatar Aug 24 '20 10:08 rubiin

there is some WIP here:

https://github.com/UTGuy/mikro-orm-mssql

Going forward I'd like to support it natively, although not a priority.

B4nan avatar Aug 25 '20 12:08 B4nan

there is some WIP here:

https://github.com/UTGuy/mikro-orm-mssql

Going forward I'd like to support it natively, although not a priority.

I am actually starting out a new project in about two weeks later which is on mssql and wanted to use mikroorm instead of sequelize but I am not only the sole developer in the project so we are looking for sequelize alternative which supports mssql out of the box

rubiin avatar Aug 25 '20 14:08 rubiin

Will try to spend few hours to check how much is actually done and what is the needed effort to support it.

B4nan avatar Aug 25 '20 17:08 B4nan

@B4nan any updates

rubiin avatar Oct 13 '20 07:10 rubiin

nope

https://blog.sindresorhus.com/issue-bumping-e3b9740e2a0

B4nan avatar Oct 13 '20 08:10 B4nan

I must say SQL server has very weird limitations. First I hit the issue with composite FKs that are sometimes impossible to create in a lazy manner due to SQL server trying to be too smart/strict (it does not allow setting cascading). Now I see Cannot insert explicit value for identity column in table 'book_tag2' when IDENTITY_INSERT is set to OFF. 🤷

Why are people using this? :P Seriously, go with postgres people :P

Anyway, I have around 2/3 tests passing, disabled FKs in the schema generator for now, I know what to do to make it work (and it will also allow having FKs in sqlite at least for creating new tables). So still not there, still few days/weeks ahead of me.

B4nan avatar Nov 01 '20 09:11 B4nan

yes, Sql server is too smartass .I came up with those problems when i migrated from pg to mssql

rubiin avatar Nov 01 '20 13:11 rubiin

Is this is still in progress? Originally I think it was listed as an issue worth exploring in v5 (https://github.com/mikro-orm/mikro-orm/issues/1623), but its not listed there anymore. If there are any blockers, how could someone help? Thanks!

svantreeck avatar Dec 09 '21 16:12 svantreeck

I believe B4nan worked on it in this MR https://github.com/mikro-orm/mikro-orm/pull/1375 guess you could have a look at it if you're interested?

Langstra avatar Dec 10 '21 15:12 Langstra

There is no progress, I don't consider this as something important, I gave it a try several times, but as for someone who never used mssql, the way that driver behaves is too much out of space to understand it. The blocker is schema generation and diffing, namely complex composite PKs and FK constraints, as that works differently than the rest of SQL drivers.

As said, there is a WIP PR, feel free to give it a try yourself if it is important to you.

If there would be some company willing to sponsor the driver development, that would be a different story.

B4nan avatar Dec 11 '21 12:12 B4nan

I just recently updated those drivers. While schema generation is out of the question the driver does function perfectly fine. I also added a Unicode type to handle nvarchar columns.

UTGuy avatar Mar 29 '22 18:03 UTGuy

I cannot use Micro ORM because it does not support MS SQL

sauravyadav1958 avatar Jul 22 '22 14:07 sauravyadav1958

I have opened a bug bounty for this issue https://app.bountysource.com/issues/92424462-mssql-support if that is okay with you @B4nan. @sauravyadav1958 if you can't donate with your time and it's that important for you, you might consider adding to the bounty to help the creator or @UTGuy make an implementation.

Outternet avatar Jul 29 '22 12:07 Outternet

FYI we are quite close to bringing this live. Last missing piece of puzzle is the schema diffing .

With that said, it took a lot of time already for me as well as @UTGuy, so being close does not mean it will happen soon :]

Intereting idea with the bug bounty, it can definitely change the order of priorities. For me this was kind of a black hole for my spare time, so I usually favour issues I can deal with within hours and not weeks :D I think it would be fair to divide that somehow between me and @UTGuy once we finilize this.

B4nan avatar Jul 29 '22 13:07 B4nan

I don't mind donating to an almost-finished feature, I love the stability of Mikro-Orm (switched from TypeOrm) and unit-of-work of course. Bug bounties are meant to show interest in certain features (and it might alter the priority, which would be a plus for me personally :D). You can do a joint claim with @UTGuy I think, otherwise, the claimer needs to distributor it manually. Feel free to prioritize how you see fit, I am just placing it to show my support.

Outternet avatar Jul 29 '22 13:07 Outternet

About to start a rather large project that relies on a SQL Server DB.. would love to use Mikro ORM, is this driver still a ways out from being pulled in?

justinhenricks avatar Sep 26 '22 21:09 justinhenricks

Any news about this?

SteadEXE avatar Sep 18 '23 12:09 SteadEXE

most other orms use tedious package to work with mssql maybe that would help

rubiin avatar Sep 18 '23 14:09 rubiin

Will be good to incapsulate tedious into mikro-orm-mssql driver. Is it possible?

ruscon avatar Nov 15 '23 14:11 ruscon

Another ORM called RDB supports mssql. github.com/alfateam/rdb

lroal avatar Feb 05 '24 18:02 lroal

After many obstacles, #1375 is near the finish line and will be part of v6.2.

B4nan avatar Apr 03 '24 22:04 B4nan

@B4nan Great news, thanks. We are looking forward to testing it.

ruscon avatar Apr 03 '24 23:04 ruscon