refactor(db): remove TMDB and IMDB IDs from people table
Remove tmdb_id and imdb_id columns along with associated indexes and unique constraints from the people table to simplify the schema and eliminate external API syncing dependencies. BREAKING CHANGE: tmdb_id and imdb_id fields are no longer available in the people table, which may affect any code relying on these external identifiers.
This commit is contained in:
6
apps/server/src/db/migrations/0002_high_freak.sql
Normal file
6
apps/server/src/db/migrations/0002_high_freak.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
DROP INDEX IF EXISTS `people_tmdb_id_unique`;--> statement-breakpoint
|
||||
DROP INDEX IF EXISTS `people_imdb_id_unique`;--> statement-breakpoint
|
||||
DROP INDEX IF EXISTS `idx_people_tmdb`;--> statement-breakpoint
|
||||
DROP INDEX IF EXISTS `idx_people_imdb`;--> statement-breakpoint
|
||||
ALTER TABLE `people` DROP COLUMN `tmdb_id`;--> statement-breakpoint
|
||||
ALTER TABLE `people` DROP COLUMN `imdb_id`;
|
||||
1876
apps/server/src/db/migrations/meta/0002_snapshot.json
Normal file
1876
apps/server/src/db/migrations/meta/0002_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,13 @@
|
||||
"when": 1759732865060,
|
||||
"tag": "0001_youthful_supernaut",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "6",
|
||||
"when": 1760209905266,
|
||||
"tag": "0002_high_freak",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,18 +6,13 @@ export const people = sqliteTable(
|
||||
{
|
||||
id: text("id")
|
||||
.primaryKey()
|
||||
.$defaultFn(() => {
|
||||
return `PL${Math.floor(100000 + Math.random() * 900000)}`;
|
||||
}),
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
name: text("name").notNull(),
|
||||
biography: text("biography"),
|
||||
birthday: text("birthday"), // "YYYY-MM-DD"
|
||||
deathday: text("deathday"), // "YYYY-MM-DD"
|
||||
placeOfBirth: text("place_of_birth"),
|
||||
profilePicture: text("profile_picture"),
|
||||
// External IDs for syncing with APIs like TMDB
|
||||
tmdbId: integer("tmdb_id").unique(),
|
||||
imdbId: text("imdb_id").unique(),
|
||||
createdAt: integer("created_at", { mode: "timestamp" })
|
||||
.$defaultFn(() => new Date())
|
||||
.notNull(),
|
||||
@@ -26,9 +21,5 @@ export const people = sqliteTable(
|
||||
.$onUpdate(() => new Date())
|
||||
.notNull(),
|
||||
},
|
||||
(t) => [
|
||||
index("idx_people_name").on(t.name),
|
||||
index("idx_people_tmdb").on(t.tmdbId),
|
||||
index("idx_people_imdb").on(t.imdbId),
|
||||
],
|
||||
(t) => [index("idx_people_name").on(t.name)],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user