I have recently transitioned from using SQLite to SQL Server in the t3 stack with Prisma. Despite having my models defined and setting up the database connection string, I am encountering an issue when trying to run migrations.
Upon running the commands:
npx prisma migrate dev
npx prisma db push
Prisma seems to be updating my master database instead of the database specified in the connection string. Surprisingly, no errors are being thrown in this process.
The database URL I am using looks like the following:
DATABASE_URL="sqlserver://localhost:1433;initialCatalog={MyDatabase};integratedSecurity=true;trustServerCertificate=true;"
An interesting observation is that the tables created in my migration file use 'dbo' schema instead of the desired database name.
For instance:
CREATE TABLE [dbo].[ZipCode] (
[id] NVARCHAR(1000) NOT NULL,
[userId] NVARCHAR(1000) NOT NULL,
[zipcode] NVARCHAR(1000) NOT NULL,
CONSTRAINT [ZipCode_pkey] PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [ZipCode_userId_key] UNIQUE NONCLUSTERED ([userId])
);
I'm seeking guidance on how to ensure that updates are pushed to the correct database (MyDatabase). Any insights or assistance would be greatly appreciated.