Add migration for movies table: create a new movies table with necessary fields, migrate existing data from the old movies table, and update database schema to reflect changes.
This commit is contained in:
25
drizzle/0001_elite_odin.sql
Normal file
25
drizzle/0001_elite_odin.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
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")
|
||||
SELECT "id", "title", "overview", "popularity", "poster_path", "release_date", "seen", "favorite" FROM `movies`;--> statement-breakpoint
|
||||
DROP TABLE `movies`;--> statement-breakpoint
|
||||
ALTER TABLE `__new_movies` RENAME TO `movies`;--> statement-breakpoint
|
||||
PRAGMA foreign_keys=ON;
|
||||
142
drizzle/meta/0001_snapshot.json
Normal file
142
drizzle/meta/0001_snapshot.json
Normal file
@@ -0,0 +1,142 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "c3b4d292-f58b-4df8-844c-6e534034c832",
|
||||
"prevId": "19a2bad6-49be-485d-ac5e-291bd3d664ad",
|
||||
"tables": {
|
||||
"movies": {
|
||||
"name": "movies",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "integer",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"title": {
|
||||
"name": "title",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"adult": {
|
||||
"name": "adult",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"backdrop_path": {
|
||||
"name": "backdrop_path",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"genre_ids": {
|
||||
"name": "genre_ids",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"original_language": {
|
||||
"name": "original_language",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"original_title": {
|
||||
"name": "original_title",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"overview": {
|
||||
"name": "overview",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"popularity": {
|
||||
"name": "popularity",
|
||||
"type": "real",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"poster_path": {
|
||||
"name": "poster_path",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"release_date": {
|
||||
"name": "release_date",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"video": {
|
||||
"name": "video",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"vote_average": {
|
||||
"name": "vote_average",
|
||||
"type": "real",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"vote_count": {
|
||||
"name": "vote_count",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"seen": {
|
||||
"name": "seen",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false,
|
||||
"default": false
|
||||
},
|
||||
"favorite": {
|
||||
"name": "favorite",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false,
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,13 @@
|
||||
"when": 1754676538678,
|
||||
"tag": "0000_breezy_lester",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "6",
|
||||
"when": 1754948246595,
|
||||
"tag": "0001_elite_odin",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user