jam-cloud/up/locations.sql

12 lines
537 B
SQL

-- locations
CREATE TABLE musicians_instruments (
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
musician_id VARCHAR(64) REFERENCES musicians(id) ON DELETE CASCADE,
instrument_id VARCHAR(64) REFERENCES instruments(id) ON DELETE CASCADE,
proficiency_level SMALLINT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE musicians_instruments ADD CONSTRAINT musician_instrument_uniqkey UNIQUE (musician_id, instrument_id);