Add collection type in database

This commit is contained in:
2025-03-02 17:28:38 +01:00
parent 5535507469
commit dbfe836ce3
4 changed files with 1073 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
ALTER TYPE "kyoo"."show_kind" ADD VALUE 'collection';--> statement-breakpoint
ALTER TABLE "kyoo"."shows" ADD COLUMN "collection_pk" integer;--> statement-breakpoint
ALTER TABLE "kyoo"."shows" ADD CONSTRAINT "shows_collection_pk_shows_pk_fk" FOREIGN KEY ("collection_pk") REFERENCES "kyoo"."shows"("pk") ON DELETE set null ON UPDATE no action;
File diff suppressed because it is too large Load Diff
+7
View File
@@ -64,6 +64,13 @@
"when": 1738064522937,
"tag": "0008_entries",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1740872363604,
"tag": "0009_collections",
"breakpoints": true
}
]
}
+10 -1
View File
@@ -1,5 +1,6 @@
import { relations, sql } from "drizzle-orm";
import {
type AnyPgColumn,
check,
date,
index,
@@ -16,7 +17,11 @@ import { entries } from "./entries";
import { seasons } from "./seasons";
import { image, language, schema } from "./utils";
export const showKind = schema.enum("show_kind", ["serie", "movie"]);
export const showKind = schema.enum("show_kind", [
"serie",
"movie",
"collection",
]);
export const showStatus = schema.enum("show_status", [
"unknown",
"finished",
@@ -78,6 +83,10 @@ export const shows = schema.table(
endAir: date(),
originalLanguage: language(),
collectionPk: integer().references((): AnyPgColumn => shows.pk, {
onDelete: "set null",
}),
externalId: externalid(),
createdAt: timestamp({ withTimezone: true, mode: "string" })