16 lines
884 B
SQL
16 lines
884 B
SQL
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
CREATE TABLE `__new_characterHistory` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`characterId` text,
|
|
`date` integer NOT NULL,
|
|
`won` integer DEFAULT 0 NOT NULL,
|
|
`createdAt` integer NOT NULL,
|
|
`updatedAt` integer NOT NULL,
|
|
FOREIGN KEY (`characterId`) REFERENCES `character`(`id`) ON UPDATE no action ON DELETE no action
|
|
);
|
|
--> statement-breakpoint
|
|
INSERT INTO `__new_characterHistory`("id", "characterId", "date", "won", "createdAt", "updatedAt") SELECT "id", "characterId", "date", "won", "createdAt", "updatedAt" FROM `characterHistory`;--> statement-breakpoint
|
|
DROP TABLE `characterHistory`;--> statement-breakpoint
|
|
ALTER TABLE `__new_characterHistory` RENAME TO `characterHistory`;--> statement-breakpoint
|
|
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `characterHistory_date_unique` ON `characterHistory` (`date`); |