You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @chuanqisun, we do support Azure SQL due to it being SQL Server 2017 underneath. Most of our tests for now run against the dockerized versions of SQL Server 2017 and 2019, but Azure SQL is a first priority for us.
It is very much possible we're also working just fine with versions from 2012 forward, but right now our big test suites run against versions 2017 and 2019.
Reacted by Daniel Norman, Jan Piotrowski, Harshit Pant and Hervé Labas
I created a feature request separately in #6823 , but it probably relates to this.
Even thought SQL Server doesn't support Enums, it would be really nice to still be able to write a schema with enums for the intellisense and type information etc. If I ever have to change the database provider it would also be really nice to only have to worry about native type support/conversions and not about how the schema was structured.
Perhaps there could be some sort of flag to enforce the strong enforcement of enum support that if disabled would create a closest analog in SQL Server that at least expresses the intent of the column being an enum to those working directly with the database.
Howdy!
We are using Prisma with Azure SQL in our project and it has worked well this far! 🚀
Two things we noticed:
When connecting to Azure SQL, you need to escape at least the user in the connection string (because of the "@" between username and server name). Figuring out how to do that in JDBC connection strings took a bit of time (put the value in curly braces), as that wasn't needed with the SQL server we used locally for development.
Compared to migration scripts Entity Framework generates, Prisma's migration scripts don't wrap them in transactions or track the migration history in the scripts themselves. I'm not an expert on the topic, so I'm not sure if these things are really needed, but maybe a thing to look at? Below a sample of the EF migration script
BEGIN TRANSACTION;
GO
<migrate stuff>
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20XXXXXXXXXX_AddObject', N'5.0.0');
GO
COMMIT;
GO
Could you give an example of a connection string that works differently in SQL Server compared to Prisma?
Yeah, due to none of the other databases we support allow running migrations in transactions, we don't do that to SQL Server either. I'm raising up this issue in today's Migrate team meeting though.
But with Azure SQL escaping the user is needed (and most likely the password also). That's a JDBC connection string copied from Azure portal for the database.
The logs prisma CLI gives is a bit odd, but seems to work:
❯ npx prisma migrate deploy
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQL Server database "undefined" at "<server>};password={<password>};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;:1433"
1 migration found in prisma/migrations
The following migration have been applied:
migrations/
└─ 20210614080427_init/
└─ migration.sql
All migrations have been successfully applied.
Thank you @luomavaltteri for the report.
This full connection string (which includes password)
Datasource "db": SQL Server database "undefined" at "};password={};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;:1433"
This is not expected from the CLI, we make sure that only the server host and port are logged for the other connectors and it seems we forgot something for SQL Server.
I fixed that in our dev version and will be part of 2.25.0 release.
Not sure if this question belongs here, but anyway:
I am currently using TypeORM and evaluating Prisma. I have a Database in Azure/SQL Server with multiple schemas, each schema having few tables in them. Is it possible to specify for each model in Prisma schema to which DB schema it belongs? In the future I may need to write queries that SELECTs data from tables from multiple Db schemas.
It seems that Prisma always uses the default dbo DB schema and I don't see anywhere a possibility to override it.
Activity
[-]Preview feature feedback: MSSQL (`microsoftSqlServer`) (since 2.10.0)[/-][+]Preview feature feedback: `microsoftSqlServer`[/+]chuanqisun commentedon Oct 27, 2020
Hi @2color, does this include Azure SQL? or it's just the on prem MS SQL?
pimeys commentedon Oct 28, 2020
Hi @chuanqisun, we do support Azure SQL due to it being SQL Server 2017 underneath. Most of our tests for now run against the dockerized versions of SQL Server 2017 and 2019, but Azure SQL is a first priority for us.
It is very much possible we're also working just fine with versions from 2012 forward, but right now our big test suites run against versions 2017 and 2019.
josh-hemphill commentedon Apr 27, 2021
I created a feature request separately in #6823 , but it probably relates to this.
Even thought SQL Server doesn't support Enums, it would be really nice to still be able to write a schema with enums for the intellisense and type information etc. If I ever have to change the database provider it would also be really nice to only have to worry about native type support/conversions and not about how the schema was structured.
Perhaps there could be some sort of flag to enforce the strong enforcement of enum support that if disabled would create a closest analog in SQL Server that at least expresses the intent of the column being an enum to those working directly with the database.
luomavaltteri commentedon Jun 14, 2021
Howdy!
We are using Prisma with Azure SQL in our project and it has worked well this far! 🚀
Two things we noticed:
Keep up the good work 👍
pimeys commentedon Jun 14, 2021
Hey @luomavaltteri,
luomavaltteri commentedon Jun 14, 2021
So for a SQL server something like this works in the .env file:
But with Azure SQL escaping the user is needed (and most likely the password also). That's a JDBC connection string copied from Azure portal for the database.
The logs prisma CLI gives is a bit odd, but seems to work:
pimeys commentedon Jun 14, 2021
Checking the connection string problem right away.
Created an issue for you for migrations wrapped in plast... transactions.
#7641
P.s. @luomavaltteri if you're in our public slack, send me a PM, I like to ask a few questions from our SQL Server users before GA.
luomavaltteri commentedon Jun 14, 2021
Thanks @pimeys, I'll join your Slack 👍
Jolg42 commentedon Jun 15, 2021
Thank you @luomavaltteri for the report.
This full connection string (which includes password)
This is not expected from the CLI, we make sure that only the server host and port are logged for the other connectors and it seems we forgot something for SQL Server.
I fixed that in our dev version and will be part of 2.25.0 release.
janconc commentedon Jun 24, 2021
Hi guys,
Not sure if this question belongs here, but anyway:
I am currently using TypeORM and evaluating Prisma. I have a Database in Azure/SQL Server with multiple schemas, each schema having few tables in them. Is it possible to specify for each model in Prisma schema to which DB schema it belongs? In the future I may need to write queries that SELECTs data from tables from multiple Db schemas.
It seems that Prisma always uses the default
dboDB schema and I don't see anywhere a possibility to override it.Keep up the good work!
pimeys commentedon Jun 24, 2021
@janconc Not yet, please follow the issue for more details.
I wrote a few proposals internally how we could do that, but there is not yet any timeframe for this.
janpio commentedon Jun 24, 2021
For SQL Server the usage of "synonyms" might offer a temporary workaround as well @janconc: #1122 (comment)
2color commentedon Sep 7, 2021
Closing this now that this has been released to General Availability in the 3.0.1 release