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

  1. Git Pull the Latest Branch

    Pull the latest branch from your repository using git pull.

  2. Modify the Player.sql File

    Locate 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
    );
    
  3. 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;
    
  4. Build and Publish to Your Local Database

    Build the project and publish it to your local database.

  5. 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
    );
    
  6. Revert Changes in Script.PostDeployment.sql

    Delete the code you added in Step 3 and uncomment the original content.

  7. 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.