42 lines
1.5 KiB
SQL
42 lines
1.5 KiB
SQL
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
CREATE TABLE `__new_movies` (
|
|
`id` integer PRIMARY KEY NOT NULL,
|
|
`title` text NOT NULL,
|
|
`adult` integer NOT NULL,
|
|
`backdrop_path` text NOT NULL,
|
|
`genre_ids` text NOT NULL,
|
|
`original_language` text NOT NULL,
|
|
`original_title` text NOT NULL,
|
|
`overview` text NOT NULL,
|
|
`popularity` real NOT NULL,
|
|
`poster_path` text NOT NULL,
|
|
`release_date` text NOT NULL,
|
|
`video` integer NOT NULL,
|
|
`vote_average` real NOT NULL,
|
|
`vote_count` integer NOT NULL,
|
|
`seen` integer DEFAULT false,
|
|
`favorite` integer DEFAULT false
|
|
);
|
|
--> statement-breakpoint
|
|
INSERT INTO `__new_movies`("id", "title", "overview", "popularity", "poster_path", "release_date", "seen", "favorite", "adult", "backdrop_path", "genre_ids", "original_language", "original_title", "video", "vote_average", "vote_count")
|
|
SELECT
|
|
"id",
|
|
"title",
|
|
"overview",
|
|
"popularity",
|
|
"poster_path",
|
|
"release_date",
|
|
"seen",
|
|
"favorite",
|
|
0 as "adult", -- wartość domyślna
|
|
'' as "backdrop_path", -- wartość domyślna
|
|
'[]' as "genre_ids", -- wartość domyślna (pusta tablica JSON)
|
|
'pl-PL' as "original_language", -- wartość domyślna
|
|
"title" as "original_title", -- kopiuj z title
|
|
0 as "video", -- wartość domyślna
|
|
0.0 as "vote_average", -- wartość domyślna
|
|
0 as "vote_count" -- wartość domyślna
|
|
FROM `movies`;--> statement-breakpoint
|
|
DROP TABLE `movies`;--> statement-breakpoint
|
|
ALTER TABLE `__new_movies` RENAME TO `movies`;--> statement-breakpoint
|
|
PRAGMA foreign_keys=ON; |