mi/backend/migrations/2020-09-13-154110_switches/up.sql

17 lines
400 B
SQL

PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS members
( id INTEGER UNIQUE NOT NULL PRIMARY KEY
, cmene TEXT UNIQUE NOT NULL
, picurl TEXT UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS switches
( id TEXT UNIQUE NOT NULL PRIMARY KEY
, member_id INTEGER NOT NULL
, started_at TIMESTAMP NOT NULL
, ended_at TIMESTAMP
, FOREIGN KEY (member_id)
REFERENCES members(id)
);