FIX seed data

This commit is contained in:
Esa Kataja
2025-05-05 16:16:48 +03:00
parent ffdb3cbecd
commit b05c8570a1
3 changed files with 27 additions and 23 deletions
+4 -4
View File
@@ -8,7 +8,7 @@
DROP TABLE IF EXISTS Review;
DROP TABLE IF EXISTS Song;
DROP TABLE IF EXISTS "User"; -- Quoted because USER is a reserved keyword
DROP TABLE IF EXISTS "Group"; -- Quoted because GROUP is a reserved keyword
DROP TABLE IF EXISTS Team;
DROP TABLE IF EXISTS CountryCodes;
DROP SEQUENCE IF EXISTS group_id_seq;
@@ -28,7 +28,7 @@ CREATE SEQUENCE review_id_seq START 1;
-- Table: Group
-- Stores information about the different households or groups participating.
-- =============================================================================
CREATE TABLE "Group" (
CREATE TABLE "Team" (
id INTEGER PRIMARY KEY DEFAULT nextval('group_id_seq'), -- Use sequence for auto-increment
name VARCHAR UNIQUE NOT NULL, -- The name of the household/group
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the group was created
@@ -44,14 +44,14 @@ CREATE TABLE "User" (
username VARCHAR UNIQUE NOT NULL, -- The user's login name
hashed_password VARCHAR NOT NULL, -- The securely hashed password
email VARCHAR UNIQUE, -- User's email address (nullable)
group_id INTEGER NOT NULL, -- Foreign Key -> Group.id
team_id INTEGER NOT NULL, -- Foreign Key -> Group.id
avatar_id INTEGER DEFAULT 0 NOT NULL, -- Identifier for the user's avatar
is_active BOOLEAN DEFAULT TRUE NOT NULL, -- Flag indicating if the user account is active
is_admin BOOLEAN DEFAULT FALSE NOT NULL, -- Flag indicating if the user has admin privileges
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the user was created
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the user was last updated
FOREIGN KEY (group_id) REFERENCES "Group"(id) -- Link to the Group table
FOREIGN KEY (team_id) REFERENCES "Team"(id) -- Link to the Team table
);
-- =============================================================================