beacon/migrations/20250206105906_initial.sql

13 lines
393 B
SQL

-- Add migration script here
CREATE TABLE accounts (
account_id VARCHAR(10) PRIMARY KEY NOT NULL UNIQUE
);
CREATE TABLE caught_fish (
id SERIAL PRIMARY KEY,
account_id VARCHAR(10) NOT NULL,
fish_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES accounts (account_id) ON DELETE CASCADE ON UPDATE NO ACTION
);
CREATE INDEX fish_accounts ON caught_fish (account_id);