SQL
CREATE TABLE `players` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`competition_id` integer NOT NULL,
`external_id` text,
`name` text NOT NULL,
`club` text NOT NULL,
`club_external_id` text,
`position` text NOT NULL,
`price` real DEFAULT 5 NOT NULL,
`is_active` integer DEFAULT true NOT NULL,
`last_synced_at` text,
FOREIGN KEY (`competition_id`) REFERENCES `competitions`(`id`) ON UPDATE no action ON DELETE no action
)
+ Add column
Columns
Foreign Keys
| Column |
Destination |
competition_id |
competitions.id |
+ Add index
Indexes
| Name |
Columns |
Unique |
SQL |
Drop? |
| idx_player_comp_club |
|
|
SQL
CREATE INDEX `idx_player_comp_club`
ON `players` (`competition_id`,`club`)
|
Drop
|
| idx_player_comp_pos |
|
|
SQL
CREATE INDEX `idx_player_comp_pos`
ON `players` (`competition_id`,`position`)
|
Drop
|
| uq_player |
competition_id
external_id
|
✓ |
SQL
CREATE UNIQUE INDEX `uq_player`
ON `players` (`competition_id`,`external_id`)
|
Drop
|