Categories
Uncategorized

Creating Local SQL Database Error

I was making changing in our database and realized (like a duncebucket) that I was using the live database! Am I dumb or what?

So I create a testing database. I went into appsettings.json and added a testing connection string

{
  "ConnectionStrings": {
    //Production Database
    //"DefaultConnection": "Server=SERVER_NAME;Database=DatabaseName;Trusted_Connection=True;MultipleActiveResultSets=true"
    //Testing Database
    "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=TestingFolderSystem;Trusted_Connection=True;MultipleActiveResultSets=true"

  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

I tried this https://dba.stackexchange.com/a/22275 but I did not know what he meant by the current user because I was the current user but I need to get this done so I went into the SQL Server Object Explorer and just manually created the database. Then in the Package Manager Console enter the Update-Database command and vualá! It create all of the tables!

Also I am using .NET CORE MVC Code First method for the database creation.

I am still pretty new at this so forgive some of my ignorance please.