Prisma unexpectedly updates the main SQL Server database instead of the specified database in the connection string

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.

Answer №1

After further investigation following the insightful comment by @ForeverStudent, it is recommended to use initial catalog=myDbName with a space between initial and catalog. Only when formatted in this way will the initial catalog be properly recognized.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the purpose of using a tag within a Next.js Link component?

Exploring the wonders of NextJs, I can't help but question why the a tag is necessary when creating a link. In the tutorial provided, we see this example: <Link href="/"><a>Back to home</a></Link> However, the link s ...

Retrieve the properties from within a closure function in a functional component

I have developed a simple React application using create-react-app. The app consists of a single component that takes in a value and an onClick callback. When the callback is triggered, the value increments. import React, { useState } from 'react&apos ...

Invoke a function within the <img> tag to specify the source path

I have been attempting to achieve something similar to the following: <img id="icon" class="cercle icon" src="getIcon({{item.status}})" alt=""> This is my function: getIcon(status){ switch (status) { case 'Ongoing': ret ...

Incorporating personalized CSS and JavaScript into Shopify

Currently, my project involves integrating vertical tabs into a Shopify page that is utilizing the 'Atlantic' theme. Since this particular theme doesn't come with vertical tabs built-in, I have incorporated external JS and CSS files known as ...

How come the JavaScript map() function displays my feature when the forEach() function didn't work? This issue arises while working with React and Next

There was an issue with rendering my feature because React did not recognize that the state was changing. By switching from using forEach() to map(), I was able to successfully render the feature as intended. This feature retrieves user subscriptions from ...

Arrange the items in a list in JavaScript in descending sequence

How to sort a list of records in JavaScript in descending order? var number; //dynamic number retrieved from API var test; //dynamic text retrieved from API for (var i; i <= accList.length; i++) { var odlist = 'you have :' + test + number ...

The current issue lies with the lack of functionality in the Ajax post feature

Seeking assistance here. I've encountered a frequent issue on stackoverflow and despite attempting various methods, none seem to be working for me. Could it be that I'm doing something fundamentally wrong? Here is the code snippet in question: $ ...

Exploring the potential of lazy loading with AngularJS 2 RC5 ngModule

I am currently utilizing the RC5 ngModule in my Angular project. In my app.module.ts file, the import statements and module setup are as follows: import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/plat ...

Warning in NextJS: The prop target does not match. On the server: "top", on the client: "blank"

I recently encountered a warning while working on my blog project with this framework. The warning I received out of nowhere reads: react_devtools_backend.js:2273 Warning: Prop `target` did not match. Server: "_top" Client: "_blank" ...

Unit test: Using subjects instead of observables to mock a service and test the change of values over time results in TypeScript throwing error TS2339

I have a unique scenario where I have implemented a service that accesses ngrx selectors and a component that utilizes this service by injecting it and adjusting properties based on the values retrieved. For unit testing purposes, I am creating mock versi ...

What is the best way to repair a react filter?

Recently, I successfully created a database in Firebase and managed to fetch it in React. However, my current challenge is to integrate a search bar for filtering elements. The issue arises when I search for an element - everything functions as expected. ...

Implementing a translucent overlay onto a specific HTML section using sidebar.js/jQuery

Searching for a way to enhance the functionality of my website using Sidebar.js, I came across an interesting feature on hypebeast.com. When you click on the three-bar icon, the main container section's opacity changes. How can I achieve this effect? ...

Is there a way to transform a JavaScript array into JSON format in order to use it as the returned data from a RESTful API

Currently, I am exploring how to efficiently convert an array of arrays into a JSON string for retrieval through a RESTful API. On my server, data is fetched from a database in the format: {"user":"some name","age":number ...

Exploring observables for querying the OMDB API and obtaining information on movies

Hey everyone, I'm currently working on implementing a live search feature using Observables in Angular2 to fetch Movie data from the OMDB API. While I can see that it is functioning correctly in the Chrome Network tab, the results aren't showing ...

Resetting the session occurs when a sub-domain is being utilized

I'm encountering some difficulties with my ASP.NET website as I attempt to implement sub-domains. Specifically, I am facing issues where the session is being reset. I have made adjustments to my hosts file to include 'localhost', 'one. ...

Is there a method available for troubleshooting unsuccessful AJAX requests? Why might my request be failing?

Whenever I click on a button with the class "member-update-button," an alert pops up saying "got an error, bro." The error callback function is being triggered. Any thoughts on why this might be happening? No errors are showing up in the console. How can I ...

Creating unit tests without relying on a testing framework: A guide

My goal is to unit test a simple function using pure JavaScript: NS.isType = function (type, obj) { if (obj.constructor && obj.constructor.name) { return obj.constructor.name === type; } return toString.call(obj) === '[obj ...

Error arises when attempting to pass interface props to a component in a React Typescript application

I am currently delving into the world of React js and typescript. As part of my learning process, I have created a demo application that allows users to input their name and age. The app features an ErrorModal that should pop up on the screen whenever inco ...

I am unable to store a session variable using the GET method

Good day, I am seeking assistance with my code and have been searching for four hours without finding the error. I am working on an exchange where variables are stored in a session. The issue I am facing is that the variable $discount gets cleared every ti ...

Discover the steps to update the rows, adjust the number of results, and manage pagination in angular-datatable with an observable as the primary data source

Incorporating angular-datatables into my Angular 7 application has been a challenge, especially when it comes to displaying search results efficiently. Within the request-creation-component, a search form is generated. Upon clicking the submit button, an ...