mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Add collection type in database
This commit is contained in:
parent
5535507469
commit
dbfe836ce3
3
api/drizzle/0009_collections.sql
Normal file
3
api/drizzle/0009_collections.sql
Normal 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;
|
1053
api/drizzle/meta/0009_snapshot.json
Normal file
1053
api/drizzle/meta/0009_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -64,6 +64,13 @@
|
||||
"when": 1738064522937,
|
||||
"tag": "0008_entries",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 9,
|
||||
"version": "7",
|
||||
"when": 1740872363604,
|
||||
"tag": "0009_collections",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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" })
|
||||
|
Loading…
x
Reference in New Issue
Block a user