mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Type json in drizzle schemas
This commit is contained in:
		
							parent
							
								
									908e06c88f
								
							
						
					
					
						commit
						ed5d677ae1
					
				
							
								
								
									
										2
									
								
								api/drizzle/0002_shows.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								api/drizzle/0002_shows.sql
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
ALTER TABLE "kyoo"."shows" ALTER COLUMN "createdAt" SET NOT NULL;--> statement-breakpoint
 | 
			
		||||
ALTER TABLE "kyoo"."shows" ALTER COLUMN "nextRefresh" SET NOT NULL;
 | 
			
		||||
@ -102,16 +102,12 @@
 | 
			
		||||
				"entries_id_unique": {
 | 
			
		||||
					"name": "entries_id_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "id"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["id"]
 | 
			
		||||
				},
 | 
			
		||||
				"entries_slug_unique": {
 | 
			
		||||
					"name": "entries_slug_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "slug"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["slug"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"checkConstraints": {
 | 
			
		||||
@ -157,12 +153,8 @@
 | 
			
		||||
					"tableFrom": "entries_translation",
 | 
			
		||||
					"tableTo": "entries",
 | 
			
		||||
					"schemaTo": "kyoo",
 | 
			
		||||
          "columnsFrom": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
          "columnsTo": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
					"columnsFrom": ["pk"],
 | 
			
		||||
					"columnsTo": ["pk"],
 | 
			
		||||
					"onDelete": "cascade",
 | 
			
		||||
					"onUpdate": "no action"
 | 
			
		||||
				}
 | 
			
		||||
@ -170,10 +162,7 @@
 | 
			
		||||
			"compositePrimaryKeys": {
 | 
			
		||||
				"entries_translation_pk_language_pk": {
 | 
			
		||||
					"name": "entries_translation_pk_language_pk",
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "pk",
 | 
			
		||||
            "language"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["pk", "language"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"uniqueConstraints": {},
 | 
			
		||||
@ -184,13 +173,7 @@
 | 
			
		||||
		"kyoo.entry_type": {
 | 
			
		||||
			"name": "entry_type",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
      "values": [
 | 
			
		||||
        "unknown",
 | 
			
		||||
        "episode",
 | 
			
		||||
        "movie",
 | 
			
		||||
        "special",
 | 
			
		||||
        "extra"
 | 
			
		||||
      ]
 | 
			
		||||
			"values": ["unknown", "episode", "movie", "special", "extra"]
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	"schemas": {},
 | 
			
		||||
 | 
			
		||||
@ -109,16 +109,12 @@
 | 
			
		||||
				"entries_id_unique": {
 | 
			
		||||
					"name": "entries_id_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "id"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["id"]
 | 
			
		||||
				},
 | 
			
		||||
				"entries_slug_unique": {
 | 
			
		||||
					"name": "entries_slug_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "slug"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["slug"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"checkConstraints": {
 | 
			
		||||
@ -164,12 +160,8 @@
 | 
			
		||||
					"tableFrom": "entries_translation",
 | 
			
		||||
					"tableTo": "entries",
 | 
			
		||||
					"schemaTo": "kyoo",
 | 
			
		||||
          "columnsFrom": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
          "columnsTo": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
					"columnsFrom": ["pk"],
 | 
			
		||||
					"columnsTo": ["pk"],
 | 
			
		||||
					"onDelete": "cascade",
 | 
			
		||||
					"onUpdate": "no action"
 | 
			
		||||
				}
 | 
			
		||||
@ -177,10 +169,7 @@
 | 
			
		||||
			"compositePrimaryKeys": {
 | 
			
		||||
				"entries_translation_pk_language_pk": {
 | 
			
		||||
					"name": "entries_translation_pk_language_pk",
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "pk",
 | 
			
		||||
            "language"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["pk", "language"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"uniqueConstraints": {},
 | 
			
		||||
@ -270,12 +259,8 @@
 | 
			
		||||
					"tableFrom": "show_translations",
 | 
			
		||||
					"tableTo": "shows",
 | 
			
		||||
					"schemaTo": "kyoo",
 | 
			
		||||
          "columnsFrom": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
          "columnsTo": [
 | 
			
		||||
            "pk"
 | 
			
		||||
          ],
 | 
			
		||||
					"columnsFrom": ["pk"],
 | 
			
		||||
					"columnsTo": ["pk"],
 | 
			
		||||
					"onDelete": "cascade",
 | 
			
		||||
					"onUpdate": "no action"
 | 
			
		||||
				}
 | 
			
		||||
@ -283,10 +268,7 @@
 | 
			
		||||
			"compositePrimaryKeys": {
 | 
			
		||||
				"show_translations_pk_language_pk": {
 | 
			
		||||
					"name": "show_translations_pk_language_pk",
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "pk",
 | 
			
		||||
            "language"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["pk", "language"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"uniqueConstraints": {},
 | 
			
		||||
@ -398,16 +380,12 @@
 | 
			
		||||
				"shows_id_unique": {
 | 
			
		||||
					"name": "shows_id_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "id"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["id"]
 | 
			
		||||
				},
 | 
			
		||||
				"shows_slug_unique": {
 | 
			
		||||
					"name": "shows_slug_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
          "columns": [
 | 
			
		||||
            "slug"
 | 
			
		||||
          ]
 | 
			
		||||
					"columns": ["slug"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"checkConstraints": {
 | 
			
		||||
@ -422,13 +400,7 @@
 | 
			
		||||
		"kyoo.entry_type": {
 | 
			
		||||
			"name": "entry_type",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
      "values": [
 | 
			
		||||
        "unknown",
 | 
			
		||||
        "episode",
 | 
			
		||||
        "movie",
 | 
			
		||||
        "special",
 | 
			
		||||
        "extra"
 | 
			
		||||
      ]
 | 
			
		||||
			"values": ["unknown", "episode", "movie", "special", "extra"]
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.genres": {
 | 
			
		||||
			"name": "genres",
 | 
			
		||||
@ -462,20 +434,12 @@
 | 
			
		||||
		"kyoo.show_kind": {
 | 
			
		||||
			"name": "show_kind",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
      "values": [
 | 
			
		||||
        "serie",
 | 
			
		||||
        "movie"
 | 
			
		||||
      ]
 | 
			
		||||
			"values": ["serie", "movie"]
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.show_status": {
 | 
			
		||||
			"name": "show_status",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
      "values": [
 | 
			
		||||
        "unknown",
 | 
			
		||||
        "finished",
 | 
			
		||||
        "airing",
 | 
			
		||||
        "planned"
 | 
			
		||||
      ]
 | 
			
		||||
			"values": ["unknown", "finished", "airing", "planned"]
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	"schemas": {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										455
									
								
								api/drizzle/meta/0002_snapshot.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										455
									
								
								api/drizzle/meta/0002_snapshot.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,455 @@
 | 
			
		||||
{
 | 
			
		||||
	"id": "1948acaf-7a29-4521-988d-439653779e39",
 | 
			
		||||
	"prevId": "0f48a319-94fe-4bcc-b63c-28ce280abc9a",
 | 
			
		||||
	"version": "7",
 | 
			
		||||
	"dialect": "postgresql",
 | 
			
		||||
	"tables": {
 | 
			
		||||
		"kyoo.entries": {
 | 
			
		||||
			"name": "entries",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"columns": {
 | 
			
		||||
				"pk": {
 | 
			
		||||
					"name": "pk",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": true,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"identity": {
 | 
			
		||||
						"type": "always",
 | 
			
		||||
						"name": "entries_pk_seq",
 | 
			
		||||
						"schema": "kyoo",
 | 
			
		||||
						"increment": "1",
 | 
			
		||||
						"startWith": "1",
 | 
			
		||||
						"minValue": "1",
 | 
			
		||||
						"maxValue": "2147483647",
 | 
			
		||||
						"cache": "1",
 | 
			
		||||
						"cycle": false
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
				"id": {
 | 
			
		||||
					"name": "id",
 | 
			
		||||
					"type": "uuid",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"default": "gen_random_uuid()"
 | 
			
		||||
				},
 | 
			
		||||
				"slug": {
 | 
			
		||||
					"name": "slug",
 | 
			
		||||
					"type": "varchar(255)",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"order": {
 | 
			
		||||
					"name": "order",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"seasonNumber": {
 | 
			
		||||
					"name": "seasonNumber",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"episodeNumber": {
 | 
			
		||||
					"name": "episodeNumber",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"type": {
 | 
			
		||||
					"name": "type",
 | 
			
		||||
					"type": "entry_type",
 | 
			
		||||
					"typeSchema": "kyoo",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"airDate": {
 | 
			
		||||
					"name": "airDate",
 | 
			
		||||
					"type": "date",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"runtime": {
 | 
			
		||||
					"name": "runtime",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"thumbnails": {
 | 
			
		||||
					"name": "thumbnails",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"externalId": {
 | 
			
		||||
					"name": "externalId",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"default": "'{}'::jsonb"
 | 
			
		||||
				},
 | 
			
		||||
				"createdAt": {
 | 
			
		||||
					"name": "createdAt",
 | 
			
		||||
					"type": "timestamp with time zone",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false,
 | 
			
		||||
					"default": "now()"
 | 
			
		||||
				},
 | 
			
		||||
				"nextRefresh": {
 | 
			
		||||
					"name": "nextRefresh",
 | 
			
		||||
					"type": "timestamp with time zone",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"indexes": {},
 | 
			
		||||
			"foreignKeys": {},
 | 
			
		||||
			"compositePrimaryKeys": {},
 | 
			
		||||
			"uniqueConstraints": {
 | 
			
		||||
				"entries_id_unique": {
 | 
			
		||||
					"name": "entries_id_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
					"columns": ["id"]
 | 
			
		||||
				},
 | 
			
		||||
				"entries_slug_unique": {
 | 
			
		||||
					"name": "entries_slug_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
					"columns": ["slug"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"checkConstraints": {
 | 
			
		||||
				"orderPositive": {
 | 
			
		||||
					"name": "orderPositive",
 | 
			
		||||
					"value": "\"entries\".\"order\" >= 0"
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.entries_translation": {
 | 
			
		||||
			"name": "entries_translation",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"columns": {
 | 
			
		||||
				"pk": {
 | 
			
		||||
					"name": "pk",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"language": {
 | 
			
		||||
					"name": "language",
 | 
			
		||||
					"type": "varchar(255)",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"name": {
 | 
			
		||||
					"name": "name",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"description": {
 | 
			
		||||
					"name": "description",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"indexes": {},
 | 
			
		||||
			"foreignKeys": {
 | 
			
		||||
				"entries_translation_pk_entries_pk_fk": {
 | 
			
		||||
					"name": "entries_translation_pk_entries_pk_fk",
 | 
			
		||||
					"tableFrom": "entries_translation",
 | 
			
		||||
					"tableTo": "entries",
 | 
			
		||||
					"schemaTo": "kyoo",
 | 
			
		||||
					"columnsFrom": ["pk"],
 | 
			
		||||
					"columnsTo": ["pk"],
 | 
			
		||||
					"onDelete": "cascade",
 | 
			
		||||
					"onUpdate": "no action"
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"compositePrimaryKeys": {
 | 
			
		||||
				"entries_translation_pk_language_pk": {
 | 
			
		||||
					"name": "entries_translation_pk_language_pk",
 | 
			
		||||
					"columns": ["pk", "language"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"uniqueConstraints": {},
 | 
			
		||||
			"checkConstraints": {}
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.show_translations": {
 | 
			
		||||
			"name": "show_translations",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"columns": {
 | 
			
		||||
				"pk": {
 | 
			
		||||
					"name": "pk",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"language": {
 | 
			
		||||
					"name": "language",
 | 
			
		||||
					"type": "varchar(255)",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"name": {
 | 
			
		||||
					"name": "name",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"description": {
 | 
			
		||||
					"name": "description",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"tagline": {
 | 
			
		||||
					"name": "tagline",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"aliases": {
 | 
			
		||||
					"name": "aliases",
 | 
			
		||||
					"type": "text[]",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"tags": {
 | 
			
		||||
					"name": "tags",
 | 
			
		||||
					"type": "text[]",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"trailerUrl": {
 | 
			
		||||
					"name": "trailerUrl",
 | 
			
		||||
					"type": "text",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"poster": {
 | 
			
		||||
					"name": "poster",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"thumbnail": {
 | 
			
		||||
					"name": "thumbnail",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"banner": {
 | 
			
		||||
					"name": "banner",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"logo": {
 | 
			
		||||
					"name": "logo",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"indexes": {},
 | 
			
		||||
			"foreignKeys": {
 | 
			
		||||
				"show_translations_pk_shows_pk_fk": {
 | 
			
		||||
					"name": "show_translations_pk_shows_pk_fk",
 | 
			
		||||
					"tableFrom": "show_translations",
 | 
			
		||||
					"tableTo": "shows",
 | 
			
		||||
					"schemaTo": "kyoo",
 | 
			
		||||
					"columnsFrom": ["pk"],
 | 
			
		||||
					"columnsTo": ["pk"],
 | 
			
		||||
					"onDelete": "cascade",
 | 
			
		||||
					"onUpdate": "no action"
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"compositePrimaryKeys": {
 | 
			
		||||
				"show_translations_pk_language_pk": {
 | 
			
		||||
					"name": "show_translations_pk_language_pk",
 | 
			
		||||
					"columns": ["pk", "language"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"uniqueConstraints": {},
 | 
			
		||||
			"checkConstraints": {}
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.shows": {
 | 
			
		||||
			"name": "shows",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"columns": {
 | 
			
		||||
				"pk": {
 | 
			
		||||
					"name": "pk",
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"primaryKey": true,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"identity": {
 | 
			
		||||
						"type": "always",
 | 
			
		||||
						"name": "shows_pk_seq",
 | 
			
		||||
						"schema": "kyoo",
 | 
			
		||||
						"increment": "1",
 | 
			
		||||
						"startWith": "1",
 | 
			
		||||
						"minValue": "1",
 | 
			
		||||
						"maxValue": "2147483647",
 | 
			
		||||
						"cache": "1",
 | 
			
		||||
						"cycle": false
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
				"id": {
 | 
			
		||||
					"name": "id",
 | 
			
		||||
					"type": "uuid",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"default": "gen_random_uuid()"
 | 
			
		||||
				},
 | 
			
		||||
				"slug": {
 | 
			
		||||
					"name": "slug",
 | 
			
		||||
					"type": "varchar(255)",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"kind": {
 | 
			
		||||
					"name": "kind",
 | 
			
		||||
					"type": "show_kind",
 | 
			
		||||
					"typeSchema": "kyoo",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"genres": {
 | 
			
		||||
					"name": "genres",
 | 
			
		||||
					"type": "genres[]",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"rating": {
 | 
			
		||||
					"name": "rating",
 | 
			
		||||
					"type": "smallint",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"status": {
 | 
			
		||||
					"name": "status",
 | 
			
		||||
					"type": "show_status",
 | 
			
		||||
					"typeSchema": "kyoo",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				},
 | 
			
		||||
				"startAir": {
 | 
			
		||||
					"name": "startAir",
 | 
			
		||||
					"type": "date",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"endAir": {
 | 
			
		||||
					"name": "endAir",
 | 
			
		||||
					"type": "date",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"originalLanguage": {
 | 
			
		||||
					"name": "originalLanguage",
 | 
			
		||||
					"type": "varchar(255)",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": false
 | 
			
		||||
				},
 | 
			
		||||
				"externalId": {
 | 
			
		||||
					"name": "externalId",
 | 
			
		||||
					"type": "jsonb",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"default": "'{}'::jsonb"
 | 
			
		||||
				},
 | 
			
		||||
				"createdAt": {
 | 
			
		||||
					"name": "createdAt",
 | 
			
		||||
					"type": "timestamp with time zone",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true,
 | 
			
		||||
					"default": "now()"
 | 
			
		||||
				},
 | 
			
		||||
				"nextRefresh": {
 | 
			
		||||
					"name": "nextRefresh",
 | 
			
		||||
					"type": "timestamp with time zone",
 | 
			
		||||
					"primaryKey": false,
 | 
			
		||||
					"notNull": true
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"indexes": {},
 | 
			
		||||
			"foreignKeys": {},
 | 
			
		||||
			"compositePrimaryKeys": {},
 | 
			
		||||
			"uniqueConstraints": {
 | 
			
		||||
				"shows_id_unique": {
 | 
			
		||||
					"name": "shows_id_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
					"columns": ["id"]
 | 
			
		||||
				},
 | 
			
		||||
				"shows_slug_unique": {
 | 
			
		||||
					"name": "shows_slug_unique",
 | 
			
		||||
					"nullsNotDistinct": false,
 | 
			
		||||
					"columns": ["slug"]
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			"checkConstraints": {
 | 
			
		||||
				"ratingValid": {
 | 
			
		||||
					"name": "ratingValid",
 | 
			
		||||
					"value": "0 <= \"shows\".\"rating\" && \"shows\".\"rating\" <= 100"
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	"enums": {
 | 
			
		||||
		"kyoo.entry_type": {
 | 
			
		||||
			"name": "entry_type",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"values": ["unknown", "episode", "movie", "special", "extra"]
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.genres": {
 | 
			
		||||
			"name": "genres",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"values": [
 | 
			
		||||
				"action",
 | 
			
		||||
				"adventure",
 | 
			
		||||
				"animation",
 | 
			
		||||
				"comedy",
 | 
			
		||||
				"crime",
 | 
			
		||||
				"documentary",
 | 
			
		||||
				"drama",
 | 
			
		||||
				"family",
 | 
			
		||||
				"fantasy",
 | 
			
		||||
				"history",
 | 
			
		||||
				"horror",
 | 
			
		||||
				"music",
 | 
			
		||||
				"mystery",
 | 
			
		||||
				"romance",
 | 
			
		||||
				"science-fiction",
 | 
			
		||||
				"thriller",
 | 
			
		||||
				"war",
 | 
			
		||||
				"western",
 | 
			
		||||
				"kids",
 | 
			
		||||
				"reality",
 | 
			
		||||
				"politics",
 | 
			
		||||
				"soap",
 | 
			
		||||
				"talk"
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.show_kind": {
 | 
			
		||||
			"name": "show_kind",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"values": ["serie", "movie"]
 | 
			
		||||
		},
 | 
			
		||||
		"kyoo.show_status": {
 | 
			
		||||
			"name": "show_status",
 | 
			
		||||
			"schema": "kyoo",
 | 
			
		||||
			"values": ["unknown", "finished", "airing", "planned"]
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	"schemas": {
 | 
			
		||||
		"kyoo": "kyoo"
 | 
			
		||||
	},
 | 
			
		||||
	"sequences": {},
 | 
			
		||||
	"views": {},
 | 
			
		||||
	"_meta": {
 | 
			
		||||
		"columns": {},
 | 
			
		||||
		"schemas": {},
 | 
			
		||||
		"tables": {}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -15,6 +15,13 @@
 | 
			
		||||
			"when": 1730477283024,
 | 
			
		||||
			"tag": "0001_shows",
 | 
			
		||||
			"breakpoints": true
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"idx": 2,
 | 
			
		||||
			"version": "7",
 | 
			
		||||
			"when": 1730487641214,
 | 
			
		||||
			"tag": "0002_shows",
 | 
			
		||||
			"breakpoints": true
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
@ -10,7 +10,7 @@ import {
 | 
			
		||||
	uuid,
 | 
			
		||||
	varchar,
 | 
			
		||||
} from "drizzle-orm/pg-core";
 | 
			
		||||
import { language, schema } from "./utils";
 | 
			
		||||
import { image, language, schema } from "./utils";
 | 
			
		||||
 | 
			
		||||
export const entryType = schema.enum("entry_type", [
 | 
			
		||||
	"unknown",
 | 
			
		||||
@ -33,7 +33,7 @@ export const entries = schema.table(
 | 
			
		||||
		type: entryType().notNull(),
 | 
			
		||||
		airDate: date(),
 | 
			
		||||
		runtime: integer(),
 | 
			
		||||
		thumbnails: jsonb(),
 | 
			
		||||
		thumbnails: image(),
 | 
			
		||||
 | 
			
		||||
		externalId: jsonb().notNull().default({}),
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -11,10 +11,15 @@ import {
 | 
			
		||||
	uuid,
 | 
			
		||||
	varchar,
 | 
			
		||||
} from "drizzle-orm/pg-core";
 | 
			
		||||
import { language, schema } from "./utils";
 | 
			
		||||
import { externalid, image, language, schema } from "./utils";
 | 
			
		||||
 | 
			
		||||
export const showKind = schema.enum("show_kind", ["serie", "movie"]);
 | 
			
		||||
export const showStatus = schema.enum("show_status", ["unknown", "finished", "airing", "planned"]);
 | 
			
		||||
export const showStatus = schema.enum("show_status", [
 | 
			
		||||
	"unknown",
 | 
			
		||||
	"finished",
 | 
			
		||||
	"airing",
 | 
			
		||||
	"planned",
 | 
			
		||||
]);
 | 
			
		||||
export const genres = schema.enum("genres", [
 | 
			
		||||
	"action",
 | 
			
		||||
	"adventure",
 | 
			
		||||
@ -51,17 +56,20 @@ export const shows = schema.table(
 | 
			
		||||
		genres: genres().array().notNull(),
 | 
			
		||||
		rating: smallint(),
 | 
			
		||||
		status: showStatus().notNull(),
 | 
			
		||||
		startAir: date(),
 | 
			
		||||
		endAir: date(),
 | 
			
		||||
		startAir: date({ mode: "date" }),
 | 
			
		||||
		endAir: date({ mode: "date" }),
 | 
			
		||||
		originalLanguage: language(),
 | 
			
		||||
 | 
			
		||||
		externalId: jsonb().notNull().default({}),
 | 
			
		||||
		externalId: externalid(),
 | 
			
		||||
 | 
			
		||||
		createdAt: timestamp({ withTimezone: true }).defaultNow(),
 | 
			
		||||
		nextRefresh: timestamp({ withTimezone: true }),
 | 
			
		||||
		createdAt: timestamp({ withTimezone: true }).notNull().defaultNow(),
 | 
			
		||||
		nextRefresh: timestamp({ withTimezone: true }).notNull(),
 | 
			
		||||
	},
 | 
			
		||||
	(t) => ({
 | 
			
		||||
		ratingValid: check("ratingValid", sql`0 <= ${t.rating} && ${t.rating} <= 100`),
 | 
			
		||||
		ratingValid: check(
 | 
			
		||||
			"ratingValid",
 | 
			
		||||
			sql`0 <= ${t.rating} && ${t.rating} <= 100`,
 | 
			
		||||
		),
 | 
			
		||||
	}),
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -78,10 +86,10 @@ export const showTranslations = schema.table(
 | 
			
		||||
		aliases: text().array().notNull(),
 | 
			
		||||
		tags: text().array().notNull(),
 | 
			
		||||
		trailerUrl: text(),
 | 
			
		||||
		poster: jsonb(),
 | 
			
		||||
		thumbnail: jsonb(),
 | 
			
		||||
		banner: jsonb(),
 | 
			
		||||
		logo: jsonb(),
 | 
			
		||||
		poster: image(),
 | 
			
		||||
		thumbnail: image(),
 | 
			
		||||
		banner: image(),
 | 
			
		||||
		logo: image(),
 | 
			
		||||
	},
 | 
			
		||||
	(t) => ({
 | 
			
		||||
		pk: primaryKey({ columns: [t.pk, t.language] }),
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,22 @@
 | 
			
		||||
import { pgSchema, varchar } from "drizzle-orm/pg-core";
 | 
			
		||||
import { jsonb, pgSchema, varchar } from "drizzle-orm/pg-core";
 | 
			
		||||
 | 
			
		||||
export const schema = pgSchema("kyoo");
 | 
			
		||||
 | 
			
		||||
export const language = () => varchar({ length: 255 });
 | 
			
		||||
 | 
			
		||||
export const image = () =>
 | 
			
		||||
	jsonb().$type<{ source: string; blurhash: string }>();
 | 
			
		||||
 | 
			
		||||
export const externalid = () =>
 | 
			
		||||
	jsonb()
 | 
			
		||||
		.$type<
 | 
			
		||||
			Record<
 | 
			
		||||
				string,
 | 
			
		||||
				{
 | 
			
		||||
					dataId: string;
 | 
			
		||||
					link: string | null;
 | 
			
		||||
				}
 | 
			
		||||
			>
 | 
			
		||||
		>()
 | 
			
		||||
		.notNull()
 | 
			
		||||
		.default({});
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user