SQL

CREATE TABLE `matches`  (
  `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
  `matchday_id` integer NOT NULL,
  `external_id` integer NOT NULL,
  `home_team` text NOT NULL,
  `away_team` text NOT NULL,
  `home_team_id` integer,
  `away_team_id` integer,
  `kickoff_at` text NOT NULL,
  `status` text DEFAULT 'scheduled' NOT NULL,
  `home_score` integer,
  `away_score` integer,
  `sofascore_event_id` integer,
  FOREIGN KEY (`matchday_id`) REFERENCES `matchdays`(`id`) ON UPDATE no action ON DELETE no action
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
matchday_id INTEGER Rename | Drop
external_id INTEGER Rename | Drop
home_team TEXT Rename | Drop
away_team TEXT Rename | Drop
home_team_id INTEGER Rename | Drop
away_team_id INTEGER Rename | Drop
kickoff_at TEXT Rename | Drop
status TEXT Rename | Drop
home_score INTEGER Rename | Drop
away_score INTEGER Rename | Drop
sofascore_event_id INTEGER Rename | Drop

Foreign Keys

Column Destination
matchday_id matchdays.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_match_matchday matchday_id SQL
CREATE INDEX `idx_match_matchday`
ON `matches` (`matchday_id`)
Drop
matches_external_id_unique external_id SQL
CREATE UNIQUE INDEX `matches_external_id_unique`
ON `matches` (`external_id`)
Drop