Skip to content

Commit

Permalink
feat: create votes db table
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonVirgo committed Aug 3, 2024
1 parent fa4e08d commit 6359cfb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion migrations/0001_initial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,16 @@ CREATE TABLE IF NOT EXISTS players (
# Add a new element to players. replacements TEXT[] NOT NULL DEFAULT '{}

ALTER TABLE players
ADD COLUMN IF NOT EXISTS replacements TEXT[] NOT NULL DEFAULT '{}';
ADD COLUMN IF NOT EXISTS replacements TEXT[] NOT NULL DEFAULT '{}';

CREATE TABLE IF NOT EXISTS votes (
id SERIAL PRIMARY KEY,
author VARCHAR(32) NOT NULL,
target VARCHAR(32) NOT NULL,
target_correction VARCHAR(32),
post_number INT NOT NULL,
thread_id VARCHAR(32) NOT NULL,
player_id INT NOT NULL,
FOREIGN KEY (thread_id) REFERENCES threads(thread_id) ON DELETE CASCADE,
FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE
)

0 comments on commit 6359cfb

Please sign in to comment.