From bf2336386eac442d89d2355c90aedab217f10988 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 2 Mar 2021 21:39:16 -0600 Subject: [PATCH] feat(db): Ensure no duplicate data in the DB --- migrations/2021-03-02-022949_create_game_file_table/up.sql | 4 ++-- .../2021-03-02-025744_create_game_save_loc_table/up.sql | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migrations/2021-03-02-022949_create_game_file_table/up.sql b/migrations/2021-03-02-022949_create_game_file_table/up.sql index d98b898..0367750 100644 --- a/migrations/2021-03-02-022949_create_game_file_table/up.sql +++ b/migrations/2021-03-02-022949_create_game_file_table/up.sql @@ -1,8 +1,8 @@ -- Your SQL goes here CREATE TABLE game_file ( id INTEGER PRIMARY KEY NOT NULL, - original_path TEXT NOT NULL, -- TEXT assumes a Unicode Encoding - file_hash BLOB NOT NULL, + original_path TEXT NOT NULL UNIQUE, -- TEXT assumes a Unicode Encoding + file_hash BLOB NOT NULL UNIQUE, game_save_id INTEGER NOT NULL, FOREIGN KEY (game_save_id) REFERENCES game_save_location (id) ) \ No newline at end of file diff --git a/migrations/2021-03-02-025744_create_game_save_loc_table/up.sql b/migrations/2021-03-02-025744_create_game_save_loc_table/up.sql index 5b4d873..55ff06c 100644 --- a/migrations/2021-03-02-025744_create_game_save_loc_table/up.sql +++ b/migrations/2021-03-02-025744_create_game_save_loc_table/up.sql @@ -1,7 +1,7 @@ -- Your SQL goes here CREATE TABLE game_save_location ( id INTEGER PRIMARY KEY NOT NULL, - friendly_name TEXT, -- This can be null - original_path TEXT NOT NULL, - uuid BLOB NOT NULL + friendly_name TEXT UNIQUE, -- This can be null + original_path TEXT NOT NULL UNIQUE, + uuid BLOB NOT NULL UNIQUE ) \ No newline at end of file