SQL

CREATE TABLE `matchdays`  (
  `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
  `competition_id` integer NOT NULL,
  `number` integer NOT NULL,
  `status` text DEFAULT 'pending' NOT NULL,
  `first_match_at` text,
  `last_match_at` text,
  `sync_at` text,
  `draft_open_at` text,
  `draft_close_at` text,
  `scoring_at` text,
  FOREIGN KEY (`competition_id`) REFERENCES `competitions`(`id`) ON UPDATE no action ON DELETE no action
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
competition_id INTEGER Rename | Drop
number INTEGER Rename | Drop
status TEXT Rename | Drop
first_match_at TEXT Rename | Drop
last_match_at TEXT Rename | Drop
sync_at TEXT Rename | Drop
draft_open_at TEXT Rename | Drop
draft_close_at TEXT Rename | Drop
scoring_at TEXT Rename | Drop

Foreign Keys

Column Destination
competition_id competitions.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
uq_matchday
  • competition_id
  • number
SQL
CREATE UNIQUE INDEX `uq_matchday`
ON `matchdays` (`competition_id`,`number`)
Drop