Solutions: Issue Related to Local Database - MsCornell/2425Repo GitHub Wiki
Since we updated the database schema, this guide provides two methods to update the latest schema in your local database.
First Way
-
Git Pull the Latest Branch
Pull the latest branch from your repository using
git pull
. -
Modify the
Player.sql
FileLocate the
Player.sql
file under Database Tables in the VSC extension Database Projects. Replace its code with the following code (you can either comment out the existing code or delete it for now):CREATE TABLE Player ( Id INT PRIMARY KEY IDENTITY(1,1) UNIQUE, Name VARCHAR(150) NOT NULL, Created DATETIME DEFAULT GETDATE(), _username VARCHAR(150) NOT NULL UNIQUE, _password VARCHAR(150) NOT NULL );
-
Modify Script.PostDeployment.sql
Comment out all the existing code in Script.PostDeployment.sql, then paste the following:
DELETE FROM Game_Board; DELETE FROM Game; DELETE FROM Board; DELETE FROM Player;
-
Build and Publish to Your Local Database
Build the project and publish it to your local database.
-
Update Player.sql with the New Schema
Delete the changes you made in Step 2. Paste the following updated code into Player.sql:
CREATE TABLE Player ( Id INT PRIMARY KEY IDENTITY(1,1) UNIQUE, Name VARCHAR(150) NOT NULL UNIQUE, Created DATETIME DEFAULT GETDATE(), Email VARCHAR(150) NOT NULL UNIQUE, _password VARCHAR(150) NOT NULL );
-
Revert Changes in Script.PostDeployment.sql
Delete the code you added in Step 3 and uncomment the original content.
-
Build and Publish Again
Build the project again and publish the updated schema to your local database.
Second Way
Just delete everything involved in your local database (like a Docker container) and rebuild and publish a new local database.