mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
server: Switch to strings for IDs
This commit is contained in:
parent
3b8ed4bdb1
commit
157bdb2917
8 changed files with 132 additions and 140 deletions
|
|
@ -8,63 +8,63 @@ CREATE TABLE users (
|
|||
);
|
||||
|
||||
CREATE TABLE persons (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
first_name TEXT NOT NULL,
|
||||
last_name TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL REFERENCES users(username)
|
||||
);
|
||||
|
||||
CREATE TABLE instruments (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL REFERENCES users(username)
|
||||
);
|
||||
|
||||
CREATE TABLE works (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
composer BIGINT NOT NULL REFERENCES persons(id),
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
composer TEXT NOT NULL REFERENCES persons(id),
|
||||
title TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL REFERENCES users(username)
|
||||
);
|
||||
|
||||
CREATE TABLE instrumentations (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
work BIGINT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
instrument BIGINT NOT NULL REFERENCES instruments(id) ON DELETE CASCADE
|
||||
work TEXT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
instrument TEXT NOT NULL REFERENCES instruments(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE work_parts (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
work BIGINT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
work TEXT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
part_index BIGINT NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
composer BIGINT REFERENCES persons(id)
|
||||
composer TEXT REFERENCES persons(id)
|
||||
);
|
||||
|
||||
CREATE TABLE work_sections (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
work BIGINT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
work TEXT NOT NULL REFERENCES works(id) ON DELETE CASCADE,
|
||||
title TEXT NOT NULL,
|
||||
before_index BIGINT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE ensembles (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL REFERENCES users(username)
|
||||
);
|
||||
|
||||
CREATE TABLE recordings (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
work BIGINT NOT NULL REFERENCES works(id),
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
work TEXT NOT NULL REFERENCES works(id),
|
||||
comment TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL REFERENCES users(username)
|
||||
);
|
||||
|
||||
CREATE TABLE performances (
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
recording BIGINT NOT NULL REFERENCES recordings(id) ON DELETE CASCADE,
|
||||
person BIGINT REFERENCES persons(id),
|
||||
ensemble BIGINT REFERENCES ensembles(id),
|
||||
role BIGINT REFERENCES instruments(id)
|
||||
recording TEXT NOT NULL REFERENCES recordings(id) ON DELETE CASCADE,
|
||||
person TEXT REFERENCES persons(id),
|
||||
ensemble TEXT REFERENCES ensembles(id),
|
||||
role TEXT REFERENCES instruments(id)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue