SQL
CREATE TABLE `standings` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`competition_id` integer NOT NULL,
`manager_id` integer NOT NULL,
`total_points` real DEFAULT 0 NOT NULL,
`matchdays_played` integer DEFAULT 0 NOT NULL,
`rank` integer,
`updated_at` text DEFAULT (datetime('now')),
FOREIGN KEY (`competition_id`) REFERENCES `competitions`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`manager_id`) REFERENCES `managers`(`id`) ON UPDATE no action ON DELETE no action
)
+ Add column
Columns
Foreign Keys
| Column |
Destination |
manager_id |
managers.id |
competition_id |
competitions.id |
+ Add index
Indexes
| Name |
Columns |
Unique |
SQL |
Drop? |
| uq_standings |
competition_id
manager_id
|
✓ |
SQL
CREATE UNIQUE INDEX `uq_standings`
ON `standings` (`competition_id`,`manager_id`)
|
Drop
|