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:
2025-10-11 19:38:54 +00:00
parent 4da4fc8e6c
commit 86057aa1dd
4 changed files with 1891 additions and 11 deletions

View 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`;

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,13 @@
"when": 1759732865060,
"tag": "0001_youthful_supernaut",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1760209905266,
"tag": "0002_high_freak",
"breakpoints": true
}
]
}

View File

@@ -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)],
);