/* Replace with your SQL commands */
CREATE TABLE t_phases
(
  session_id UUID REFERENCES t_sessions (id) ON DELETE CASCADE,
  phase_no INT NOT NULL,
  start_time TIMESTAMPTZ,
  clearing_time TIMESTAMPTZ,
  planning_time TIMESTAMPTZ,
  bids_allowed BOOLEAN DEFAULT true,
  clearing_available BOOLEAN DEFAULT false,
  plannings_allowed BOOLEAN DEFAULT true,
  results_available BOOLEAN DEFAULT false,
  status TEXT CHECK (status IN ('open', 'closed')),
  PRIMARY KEY (session_id, phase_no)
);
{'avg_line_length': 32.733333333333334, 'max_line_length': 63, 'alphanum_fraction': 0.7780040733197556, 'licenses': ['MIT'], 'repository_name': 'thomas-god/parcelec', 'path': 'server/migrations/sqls/20210301182948-add-t-phases-up.sql', 'size': 491, 'lang': 'SQL'}