From 528e322bd3102ec62ea6f565825486cbba92edce Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:31:48 +0000 Subject: [PATCH 1/6] feat(media): compress uploaded images in the browser and on the server --- package.json | 2 + pnpm-lock.yaml | 16 +++++++ src/app/(payload)/admin/importMap.js | 2 + src/collections/Media.ts | 20 +++++++++ src/components/payload/ImageCompressor.tsx | 52 ++++++++++++++++++++++ src/lib/payload/compressImage.ts | 39 ++++++++++++++++ src/lib/payload/imageLimits.ts | 2 + src/lib/security/headers.ts | 2 + 8 files changed, 135 insertions(+) create mode 100644 src/components/payload/ImageCompressor.tsx create mode 100644 src/lib/payload/compressImage.ts create mode 100644 src/lib/payload/imageLimits.ts diff --git a/package.json b/package.json index f6aa351..0f28cf7 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,8 @@ "payload": "payload" }, "dependencies": { + "@jsquash/jpeg": "^1.6.0", + "@jsquash/resize": "^2.1.1", "@payloadcms/db-postgres": "3.93.0", "@payloadcms/next": "3.93.0", "@payloadcms/storage-s3": "3.93.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9dc077d..e43d840 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -166,6 +166,12 @@ importers: .: dependencies: + '@jsquash/jpeg': + specifier: ^1.6.0 + version: 1.6.0 + '@jsquash/resize': + specifier: ^2.1.1 + version: 2.1.1 '@payloadcms/db-postgres': specifier: 3.93.0 version: 3.93.0(payload@3.93.0(graphql@16.15.0)(typescript@6.0.3)) @@ -1242,6 +1248,12 @@ packages: '@jsdevtools/ono@7.1.3': resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + '@jsquash/jpeg@1.6.0': + resolution: {integrity: sha512-zwN46Awh1VM6gXlIcALwb5WzqK5H2e6+Awcs1QP8AvS8ohsK/sbE4esvmH4jhlhW7+CgiUUww66vg0aTnlSIMA==} + + '@jsquash/resize@2.1.1': + resolution: {integrity: sha512-0R5UL1ZLHUT+carjVikcE1QfA+kfNQ2YamYyGVRmhfh4zttU5EY3bQBGxPIPtY2xIAw1P4Kgyxm2xrceRw1r2w==} + '@keyv/bigmap@1.3.1': resolution: {integrity: sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==} engines: {node: '>= 18'} @@ -4669,6 +4681,10 @@ snapshots: '@jsdevtools/ono@7.1.3': {} + '@jsquash/jpeg@1.6.0': {} + + '@jsquash/resize@2.1.1': {} + '@keyv/bigmap@1.3.1(keyv@5.6.0)': dependencies: hashery: 1.5.1 diff --git a/src/app/(payload)/admin/importMap.js b/src/app/(payload)/admin/importMap.js index 585d4a3..3144f1f 100644 --- a/src/app/(payload)/admin/importMap.js +++ b/src/app/(payload)/admin/importMap.js @@ -1,9 +1,11 @@ +import { ImageCompressor as ImageCompressor_2d748e6089b36a77056ec460e02e90cd } from '../../../components/payload/ImageCompressor' import { ColorField as ColorField_386fb4f018787bb5f9192147d4ea9772 } from '../../../components/payload/ColorField' import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client' import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc' /** @type import('payload').ImportMap */ export const importMap = { + "/components/payload/ImageCompressor#ImageCompressor": ImageCompressor_2d748e6089b36a77056ec460e02e90cd, "/components/payload/ColorField#ColorField": ColorField_386fb4f018787bb5f9192147d4ea9772, "@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24, "@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 diff --git a/src/collections/Media.ts b/src/collections/Media.ts index 1902e86..af2334c 100644 --- a/src/collections/Media.ts +++ b/src/collections/Media.ts @@ -1,4 +1,5 @@ import type { CollectionConfig } from "payload"; +import { jpegQuality, maxImageSide } from "../lib/payload/imageLimits"; export const Media: CollectionConfig = { slug: "media", @@ -15,8 +16,27 @@ export const Media: CollectionConfig = { required: true, localized: true, }, + { + name: "compression", + type: "ui", + admin: { + components: { + Field: "/components/payload/ImageCompressor#ImageCompressor", + }, + }, + }, ], upload: { mimeTypes: ["image/*"], + resizeOptions: { + width: maxImageSide, + height: maxImageSide, + fit: "inside", + withoutEnlargement: true, + }, + formatOptions: { + format: "jpeg", + options: { quality: jpegQuality, progressive: true }, + }, }, }; diff --git a/src/components/payload/ImageCompressor.tsx b/src/components/payload/ImageCompressor.tsx new file mode 100644 index 0000000..9fcc562 --- /dev/null +++ b/src/components/payload/ImageCompressor.tsx @@ -0,0 +1,52 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { useField, useForm } from "@payloadcms/ui"; +import type { UIFieldClientComponent } from "payload"; +import { compressImage } from "../../lib/payload/compressImage"; + +const handled = new WeakSet(); + +const formatSize = (bytes: number) => + bytes >= 1024 * 1024 + ? `${(bytes / 1024 / 1024).toFixed(2)} MB` + : `${Math.round(bytes / 1024)} KB`; + +type Outcome = + | { status: "done"; original: number; compressed: number } + | { status: "failed" }; + +export const ImageCompressor: UIFieldClientComponent = () => { + const { value: file, setValue } = useField({ path: "file" }); + const { setProcessing } = useForm(); + const [outcome, setOutcome] = useState(null); + + useEffect(() => { + if (!(file instanceof File) || handled.has(file)) return; + handled.add(file); + setProcessing(true); + compressImage(file) + .then((compressed) => { + handled.add(compressed); + if (compressed === file) return; + setValue(compressed); + setOutcome({ + status: "done", + original: file.size, + compressed: compressed.size, + }); + }) + .catch(() => setOutcome({ status: "failed" })) + .finally(() => setProcessing(false)); + }, [file, setValue, setProcessing]); + + if (!outcome) return null; + + return ( +

+ {outcome.status === "done" + ? `Compressed in the browser: ${formatSize(outcome.original)} to ${formatSize(outcome.compressed)}.` + : "This browser could not compress the image, so the original will be uploaded and shrunk by the server."} +

+ ); +}; diff --git a/src/lib/payload/compressImage.ts b/src/lib/payload/compressImage.ts new file mode 100644 index 0000000..0072ed1 --- /dev/null +++ b/src/lib/payload/compressImage.ts @@ -0,0 +1,39 @@ +import { jpegQuality, maxImageSide } from "./imageLimits"; + +const compressible = ["image/jpeg", "image/png", "image/webp"]; + +/** Resizes to at most maxImageSide on the long side (never enlarged) and re-encodes as JPEG with jSquash. */ +export async function compressImage(file: File): Promise { + if (!compressible.includes(file.type)) return file; + const [{ default: encode }, { default: resize }] = await Promise.all([ + import("@jsquash/jpeg/encode"), + import("@jsquash/resize"), + ]); + + const bitmap = await createImageBitmap(file); + const scale = Math.min(1, maxImageSide / Math.max(bitmap.width, bitmap.height)); + const width = Math.round(bitmap.width * scale); + const height = Math.round(bitmap.height * scale); + + const canvas = new OffscreenCanvas(bitmap.width, bitmap.height); + const context = canvas.getContext("2d"); + if (!context) throw new Error("Canvas is not available"); + context.fillStyle = "#ffffff"; + context.fillRect(0, 0, bitmap.width, bitmap.height); + context.drawImage(bitmap, 0, 0); + bitmap.close(); + + let pixels = context.getImageData(0, 0, canvas.width, canvas.height); + if (scale < 1) pixels = await resize(pixels, { width, height }); + + const jpeg = await encode(pixels, { + quality: jpegQuality, + progressive: true, + }); + if (jpeg.byteLength >= file.size && file.type === "image/jpeg") return file; + + return new File([jpeg], file.name.replace(/\.[^.]+$/, "") + ".jpg", { + type: "image/jpeg", + lastModified: file.lastModified, + }); +} diff --git a/src/lib/payload/imageLimits.ts b/src/lib/payload/imageLimits.ts new file mode 100644 index 0000000..00eadac --- /dev/null +++ b/src/lib/payload/imageLimits.ts @@ -0,0 +1,2 @@ +export const maxImageSide = 2560; +export const jpegQuality = 80; diff --git a/src/lib/security/headers.ts b/src/lib/security/headers.ts index 4a85acd..7ee9104 100644 --- a/src/lib/security/headers.ts +++ b/src/lib/security/headers.ts @@ -41,6 +41,8 @@ const routePolicies: { path: string; extra: Directives }[] = [ { path: "admin", extra: { + // jSquash's WebAssembly codecs compress photos in the browser before upload. + "script-src": ["'wasm-unsafe-eval'"], "img-src": ["https://www.gravatar.com"], "connect-src": storage, "frame-src": ["'self'"], From 99d4c104579ec3bf675ebf8fdde61abe9ef94164 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:31:53 +0000 Subject: [PATCH 2/6] feat(about): add a carousel photo array to the About page global --- src/globals/pageCopy.ts | 22 +- src/migrations/20261113_001547_carousel.json | 2950 ++++++++++++++++++ src/migrations/20261113_001547_carousel.ts | 35 + src/migrations/index.ts | 8 +- src/payload-types.ts | 17 + 5 files changed, 3028 insertions(+), 4 deletions(-) create mode 100644 src/migrations/20261113_001547_carousel.json create mode 100644 src/migrations/20261113_001547_carousel.ts diff --git a/src/globals/pageCopy.ts b/src/globals/pageCopy.ts index c576d0f..72ac8b4 100644 --- a/src/globals/pageCopy.ts +++ b/src/globals/pageCopy.ts @@ -1,7 +1,11 @@ -import type { GlobalConfig } from "payload"; +import type { Field, GlobalConfig } from "payload"; import { revalidateGlobal } from "../lib/payload/revalidate"; -const pageCopy = (slug: string, tag: string): GlobalConfig => ({ +const pageCopy = ( + slug: string, + tag: string, + extraFields: Field[] = [] +): GlobalConfig => ({ slug, access: { read: () => true, @@ -10,8 +14,20 @@ const pageCopy = (slug: string, tag: string): GlobalConfig => ({ fields: [ { name: "title", type: "text", required: true, localized: true }, { name: "content", type: "textarea", required: true, localized: true }, + ...extraFields, ], }); -export const AboutPage = pageCopy("about-page", "about"); +export const AboutPage = pageCopy("about-page", "about", [ + { + name: "carousel", + type: "array", + labels: { singular: "Photo", plural: "Photos" }, + admin: { description: "Photos in the About page carousel, in order." }, + fields: [ + { name: "photo", type: "upload", relationTo: "media", required: true }, + { name: "alt", type: "text", required: true, localized: true }, + ], + }, +]); export const TourPage = pageCopy("tour-page", "tour"); diff --git a/src/migrations/20261113_001547_carousel.json b/src/migrations/20261113_001547_carousel.json new file mode 100644 index 0000000..0b521ed --- /dev/null +++ b/src/migrations/20261113_001547_carousel.json @@ -0,0 +1,2950 @@ +{ + "version": "7", + "dialect": "postgresql", + "tables": { + "public.users_sessions": { + "name": "users_sessions", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "users_sessions_order_idx": { + "name": "users_sessions_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_sessions_parent_id_idx": { + "name": "users_sessions_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "users_sessions_parent_id_fk": { + "name": "users_sessions_parent_id_fk", + "tableFrom": "users_sessions", + "tableTo": "users", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "reset_password_token": { + "name": "reset_password_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reset_password_expiration": { + "name": "reset_password_expiration", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "salt": { + "name": "salt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hash": { + "name": "hash", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reset_password_requested_at": { + "name": "reset_password_requested_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "login_attempts": { + "name": "login_attempts", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_updated_at_idx": { + "name": "users_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_created_at_idx": { + "name": "users_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_email_idx": { + "name": "users_email_idx", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.media": { + "name": "media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_objectkey": { + "name": "_objectkey", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "thumbnail_u_r_l": { + "name": "thumbnail_u_r_l", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filename": { + "name": "filename", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filesize": { + "name": "filesize", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "focal_x": { + "name": "focal_x", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "focal_y": { + "name": "focal_y", + "type": "numeric", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "media_updated_at_idx": { + "name": "media_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "media_created_at_idx": { + "name": "media_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "media_filename_idx": { + "name": "media_filename_idx", + "columns": [ + { + "expression": "filename", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.media_locales": { + "name": "media_locales", + "schema": "", + "columns": { + "alt": { + "name": "alt", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "media_locales_locale_parent_id_unique": { + "name": "media_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "media_locales_parent_id_idx": { + "name": "media_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "media_locales_parent_id_fk": { + "name": "media_locales_parent_id_fk", + "tableFrom": "media_locales", + "tableTo": "media", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tour_dates": { + "name": "tour_dates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_order": { + "name": "_order", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "event_date": { + "name": "event_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true + }, + "venue": { + "name": "venue", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location_url": { + "name": "location_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "ticket_url": { + "name": "ticket_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tour_dates__order_idx": { + "name": "tour_dates__order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "tour_dates_event_date_idx": { + "name": "tour_dates_event_date_idx", + "columns": [ + { + "expression": "event_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "tour_dates_updated_at_idx": { + "name": "tour_dates_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "tour_dates_created_at_idx": { + "name": "tour_dates_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.music_items": { + "name": "music_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_order": { + "name": "_order", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "enum_music_items_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "src": { + "name": "src", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "href": { + "name": "href", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "music_items__order_idx": { + "name": "music_items__order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "music_items_updated_at_idx": { + "name": "music_items_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "music_items_created_at_idx": { + "name": "music_items_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.music_items_locales": { + "name": "music_items_locales", + "schema": "", + "columns": { + "category": { + "name": "category", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "music_items_locales_locale_parent_id_unique": { + "name": "music_items_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "music_items_locales_parent_id_idx": { + "name": "music_items_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "music_items_locales_parent_id_fk": { + "name": "music_items_locales_parent_id_fk", + "tableFrom": "music_items_locales", + "tableTo": "music_items", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lyrics": { + "name": "lyrics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_order": { + "name": "_order", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "album": { + "name": "album", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "enum_lyrics_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lyrics__order_idx": { + "name": "lyrics__order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lyrics_updated_at_idx": { + "name": "lyrics_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lyrics_created_at_idx": { + "name": "lyrics_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lyrics_locales": { + "name": "lyrics_locales", + "schema": "", + "columns": { + "lyrics": { + "name": "lyrics", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "lyrics_locales_locale_parent_id_unique": { + "name": "lyrics_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lyrics_locales_parent_id_idx": { + "name": "lyrics_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "lyrics_locales_parent_id_fk": { + "name": "lyrics_locales_parent_id_fk", + "tableFrom": "lyrics_locales", + "tableTo": "lyrics", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_doors": { + "name": "calendar_doors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "day": { + "name": "day", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "image_id": { + "name": "image_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "_objectkey": { + "name": "_objectkey", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "thumbnail_u_r_l": { + "name": "thumbnail_u_r_l", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filename": { + "name": "filename", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filesize": { + "name": "filesize", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "calendar_doors_day_idx": { + "name": "calendar_doors_day_idx", + "columns": [ + { + "expression": "day", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_doors_image_idx": { + "name": "calendar_doors_image_idx", + "columns": [ + { + "expression": "image_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_doors_updated_at_idx": { + "name": "calendar_doors_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_doors_created_at_idx": { + "name": "calendar_doors_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_doors_filename_idx": { + "name": "calendar_doors_filename_idx", + "columns": [ + { + "expression": "filename", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "calendar_doors_image_id_media_id_fk": { + "name": "calendar_doors_image_id_media_id_fk", + "tableFrom": "calendar_doors", + "tableTo": "media", + "columnsFrom": [ + "image_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_doors_locales": { + "name": "calendar_doors_locales", + "schema": "", + "columns": { + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "calendar_doors_locales_locale_parent_id_unique": { + "name": "calendar_doors_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_doors_locales_parent_id_idx": { + "name": "calendar_doors_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "calendar_doors_locales_parent_id_fk": { + "name": "calendar_doors_locales_parent_id_fk", + "tableFrom": "calendar_doors_locales", + "tableTo": "calendar_doors", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_kv": { + "name": "payload_kv", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "payload_kv_key_idx": { + "name": "payload_kv_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_locked_documents": { + "name": "payload_locked_documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "global_slug": { + "name": "global_slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "payload_locked_documents_global_slug_idx": { + "name": "payload_locked_documents_global_slug_idx", + "columns": [ + { + "expression": "global_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_updated_at_idx": { + "name": "payload_locked_documents_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_created_at_idx": { + "name": "payload_locked_documents_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_locked_documents_rels": { + "name": "payload_locked_documents_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tour_dates_id": { + "name": "tour_dates_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "music_items_id": { + "name": "music_items_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "lyrics_id": { + "name": "lyrics_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "calendar_doors_id": { + "name": "calendar_doors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "payload_locked_documents_rels_order_idx": { + "name": "payload_locked_documents_rels_order_idx", + "columns": [ + { + "expression": "order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_parent_idx": { + "name": "payload_locked_documents_rels_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_path_idx": { + "name": "payload_locked_documents_rels_path_idx", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_users_id_idx": { + "name": "payload_locked_documents_rels_users_id_idx", + "columns": [ + { + "expression": "users_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_media_id_idx": { + "name": "payload_locked_documents_rels_media_id_idx", + "columns": [ + { + "expression": "media_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_tour_dates_id_idx": { + "name": "payload_locked_documents_rels_tour_dates_id_idx", + "columns": [ + { + "expression": "tour_dates_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_music_items_id_idx": { + "name": "payload_locked_documents_rels_music_items_id_idx", + "columns": [ + { + "expression": "music_items_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_lyrics_id_idx": { + "name": "payload_locked_documents_rels_lyrics_id_idx", + "columns": [ + { + "expression": "lyrics_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_calendar_doors_id_idx": { + "name": "payload_locked_documents_rels_calendar_doors_id_idx", + "columns": [ + { + "expression": "calendar_doors_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "payload_locked_documents_rels_parent_fk": { + "name": "payload_locked_documents_rels_parent_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "payload_locked_documents", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_users_fk": { + "name": "payload_locked_documents_rels_users_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_media_fk": { + "name": "payload_locked_documents_rels_media_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_tour_dates_fk": { + "name": "payload_locked_documents_rels_tour_dates_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "tour_dates", + "columnsFrom": [ + "tour_dates_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_music_items_fk": { + "name": "payload_locked_documents_rels_music_items_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "music_items", + "columnsFrom": [ + "music_items_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_lyrics_fk": { + "name": "payload_locked_documents_rels_lyrics_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "lyrics", + "columnsFrom": [ + "lyrics_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_calendar_doors_fk": { + "name": "payload_locked_documents_rels_calendar_doors_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "calendar_doors", + "columnsFrom": [ + "calendar_doors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_preferences": { + "name": "payload_preferences", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "payload_preferences_key_idx": { + "name": "payload_preferences_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_preferences_updated_at_idx": { + "name": "payload_preferences_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_preferences_created_at_idx": { + "name": "payload_preferences_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_preferences_rels": { + "name": "payload_preferences_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "payload_preferences_rels_order_idx": { + "name": "payload_preferences_rels_order_idx", + "columns": [ + { + "expression": "order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_preferences_rels_parent_idx": { + "name": "payload_preferences_rels_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_preferences_rels_path_idx": { + "name": "payload_preferences_rels_path_idx", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_preferences_rels_users_id_idx": { + "name": "payload_preferences_rels_users_id_idx", + "columns": [ + { + "expression": "users_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "payload_preferences_rels_parent_fk": { + "name": "payload_preferences_rels_parent_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "payload_preferences", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_users_fk": { + "name": "payload_preferences_rels_users_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payload_migrations": { + "name": "payload_migrations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "batch": { + "name": "batch", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "payload_migrations_updated_at_idx": { + "name": "payload_migrations_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_migrations_created_at_idx": { + "name": "payload_migrations_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.about_page_carousel": { + "name": "about_page_carousel", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "photo_id": { + "name": "photo_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "about_page_carousel_order_idx": { + "name": "about_page_carousel_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "about_page_carousel_parent_id_idx": { + "name": "about_page_carousel_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "about_page_carousel_photo_idx": { + "name": "about_page_carousel_photo_idx", + "columns": [ + { + "expression": "photo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "about_page_carousel_photo_id_media_id_fk": { + "name": "about_page_carousel_photo_id_media_id_fk", + "tableFrom": "about_page_carousel", + "tableTo": "media", + "columnsFrom": [ + "photo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "about_page_carousel_parent_id_fk": { + "name": "about_page_carousel_parent_id_fk", + "tableFrom": "about_page_carousel", + "tableTo": "about_page", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.about_page_carousel_locales": { + "name": "about_page_carousel_locales", + "schema": "", + "columns": { + "alt": { + "name": "alt", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "about_page_carousel_locales_locale_parent_id_unique": { + "name": "about_page_carousel_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "about_page_carousel_locales_parent_id_idx": { + "name": "about_page_carousel_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "about_page_carousel_locales_parent_id_fk": { + "name": "about_page_carousel_locales_parent_id_fk", + "tableFrom": "about_page_carousel_locales", + "tableTo": "about_page_carousel", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.about_page": { + "name": "about_page", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.about_page_locales": { + "name": "about_page_locales", + "schema": "", + "columns": { + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "about_page_locales_locale_parent_id_unique": { + "name": "about_page_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "about_page_locales_parent_id_idx": { + "name": "about_page_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "about_page_locales_parent_id_fk": { + "name": "about_page_locales_parent_id_fk", + "tableFrom": "about_page_locales", + "tableTo": "about_page", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tour_page": { + "name": "tour_page", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tour_page_locales": { + "name": "tour_page_locales", + "schema": "", + "columns": { + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "tour_page_locales_locale_parent_id_unique": { + "name": "tour_page_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "tour_page_locales_parent_id_idx": { + "name": "tour_page_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tour_page_locales_parent_id_fk": { + "name": "tour_page_locales_parent_id_fk", + "tableFrom": "tour_page_locales", + "tableTo": "tour_page", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_settings_door_colors": { + "name": "calendar_settings_door_colors", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "door": { + "name": "door", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "ink": { + "name": "ink", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "locked": { + "name": "locked", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "calendar_settings_door_colors_order_idx": { + "name": "calendar_settings_door_colors_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_settings_door_colors_parent_id_idx": { + "name": "calendar_settings_door_colors_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "calendar_settings_door_colors_parent_id_fk": { + "name": "calendar_settings_door_colors_parent_id_fk", + "tableFrom": "calendar_settings_door_colors", + "tableTo": "calendar_settings", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_settings": { + "name": "calendar_settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "behaviour_visible": { + "name": "behaviour_visible", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "behaviour_year": { + "name": "behaviour_year", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": 2026 + }, + "behaviour_opens_at_hour": { + "name": "behaviour_opens_at_hour", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "behaviour_after_end": { + "name": "behaviour_after_end", + "type": "enum_calendar_settings_behaviour_after_end", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "colors_paper": { + "name": "colors_paper", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "colors_ink": { + "name": "colors_ink", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "colors_orange": { + "name": "colors_orange", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "colors_quiet": { + "name": "colors_quiet", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "colors_border": { + "name": "colors_border", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "fonts_title": { + "name": "fonts_title", + "type": "enum_calendar_settings_fonts_title", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'georgia'" + }, + "fonts_accent": { + "name": "fonts_accent", + "type": "enum_calendar_settings_fonts_accent", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'georgia'" + }, + "fonts_body": { + "name": "fonts_body", + "type": "enum_calendar_settings_fonts_body", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "images_background_id": { + "name": "images_background_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "images_share_id": { + "name": "images_share_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "calendar_settings_images_images_background_idx": { + "name": "calendar_settings_images_images_background_idx", + "columns": [ + { + "expression": "images_background_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_settings_images_images_share_idx": { + "name": "calendar_settings_images_images_share_idx", + "columns": [ + { + "expression": "images_share_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "calendar_settings_images_background_id_media_id_fk": { + "name": "calendar_settings_images_background_id_media_id_fk", + "tableFrom": "calendar_settings", + "tableTo": "media", + "columnsFrom": [ + "images_background_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "calendar_settings_images_share_id_media_id_fk": { + "name": "calendar_settings_images_share_id_media_id_fk", + "tableFrom": "calendar_settings", + "tableTo": "media", + "columnsFrom": [ + "images_share_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.calendar_settings_locales": { + "name": "calendar_settings_locales", + "schema": "", + "columns": { + "texts_title": { + "name": "texts_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_accent_line": { + "name": "texts_accent_line", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_intro": { + "name": "texts_intro", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_date_range": { + "name": "texts_date_range", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_footer": { + "name": "texts_footer", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_sound_on": { + "name": "texts_sound_on", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_sound_off": { + "name": "texts_sound_off", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_download": { + "name": "texts_download", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "texts_holding": { + "name": "texts_holding", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "calendar_settings_locales_locale_parent_id_unique": { + "name": "calendar_settings_locales_locale_parent_id_unique", + "columns": [ + { + "expression": "_locale", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "calendar_settings_locales_parent_id_idx": { + "name": "calendar_settings_locales_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "calendar_settings_locales_parent_id_fk": { + "name": "calendar_settings_locales_parent_id_fk", + "tableFrom": "calendar_settings_locales", + "tableTo": "calendar_settings", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public._locales": { + "name": "_locales", + "schema": "public", + "values": [ + "en", + "fr" + ] + }, + "public.enum_music_items_type": { + "name": "enum_music_items_type", + "schema": "public", + "values": [ + "youtube", + "spotify", + "bandcamp" + ] + }, + "public.enum_lyrics_status": { + "name": "enum_lyrics_status", + "schema": "public", + "values": [ + "draft", + "published" + ] + }, + "public.enum_calendar_settings_behaviour_after_end": { + "name": "enum_calendar_settings_behaviour_after_end", + "schema": "public", + "values": [ + "open", + "holding" + ] + }, + "public.enum_calendar_settings_fonts_title": { + "name": "enum_calendar_settings_fonts_title", + "schema": "public", + "values": [ + "georgia", + "fraunces", + "goudy-heavyface", + "caprasimo", + "abril-fatface", + "dm-serif-display", + "playfair-display", + "shrikhand", + "alfa-slab-one", + "righteous", + "monoton", + "blanch-caps", + "bebas-neue" + ] + }, + "public.enum_calendar_settings_fonts_accent": { + "name": "enum_calendar_settings_fonts_accent", + "schema": "public", + "values": [ + "georgia", + "fraunces", + "dm-serif-display", + "playfair-display", + "damion", + "yellowtail", + "lobster" + ] + }, + "public.enum_calendar_settings_fonts_body": { + "name": "enum_calendar_settings_fonts_body", + "schema": "public", + "values": [ + "system", + "jost", + "dm-sans", + "outfit", + "fraunces" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "id": "15eab236-a6d5-4093-9634-403ceab25f35", + "prevId": "00000000-0000-0000-0000-000000000000" +} \ No newline at end of file diff --git a/src/migrations/20261113_001547_carousel.ts b/src/migrations/20261113_001547_carousel.ts new file mode 100644 index 0000000..45ead58 --- /dev/null +++ b/src/migrations/20261113_001547_carousel.ts @@ -0,0 +1,35 @@ +import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' + +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` + CREATE TABLE "about_page_carousel" ( + "_order" integer NOT NULL, + "_parent_id" integer NOT NULL, + "id" varchar PRIMARY KEY NOT NULL, + "photo_id" integer NOT NULL + ); + + CREATE TABLE "about_page_carousel_locales" ( + "alt" varchar NOT NULL, + "id" serial PRIMARY KEY NOT NULL, + "_locale" "_locales" NOT NULL, + "_parent_id" varchar NOT NULL + ); + + ALTER TABLE "about_page_carousel" ADD CONSTRAINT "about_page_carousel_photo_id_media_id_fk" FOREIGN KEY ("photo_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; + ALTER TABLE "about_page_carousel" ADD CONSTRAINT "about_page_carousel_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."about_page"("id") ON DELETE cascade ON UPDATE no action; + ALTER TABLE "about_page_carousel_locales" ADD CONSTRAINT "about_page_carousel_locales_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."about_page_carousel"("id") ON DELETE cascade ON UPDATE no action; + CREATE INDEX "about_page_carousel_order_idx" ON "about_page_carousel" USING btree ("_order"); + CREATE INDEX "about_page_carousel_parent_id_idx" ON "about_page_carousel" USING btree ("_parent_id"); + CREATE INDEX "about_page_carousel_photo_idx" ON "about_page_carousel" USING btree ("photo_id"); + CREATE UNIQUE INDEX "about_page_carousel_locales_locale_parent_id_unique" ON "about_page_carousel_locales" USING btree ("_locale","_parent_id"); + CREATE INDEX "about_page_carousel_locales_parent_id_idx" ON "about_page_carousel_locales" USING btree ("_parent_id");`) +} + +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` + ALTER TABLE "about_page_carousel" DISABLE ROW LEVEL SECURITY; + ALTER TABLE "about_page_carousel_locales" DISABLE ROW LEVEL SECURITY; + DROP TABLE "about_page_carousel" CASCADE; + DROP TABLE "about_page_carousel_locales" CASCADE;`) +} diff --git a/src/migrations/index.ts b/src/migrations/index.ts index 67b1684..0cc6f3b 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -1,6 +1,7 @@ import * as migration_20261112_223859_initial from './20261112_223859_initial'; import * as migration_20261112_232319_calendar from './20261112_232319_calendar'; import * as migration_20261112_232323_calendar_checks from './20261112_232323_calendar_checks'; +import * as migration_20261113_001547_carousel from './20261113_001547_carousel'; export const migrations = [ { @@ -16,6 +17,11 @@ export const migrations = [ { up: migration_20261112_232323_calendar_checks.up, down: migration_20261112_232323_calendar_checks.down, - name: '20261112_232323_calendar_checks' + name: '20261112_232323_calendar_checks', + }, + { + up: migration_20261113_001547_carousel.up, + down: migration_20261113_001547_carousel.down, + name: '20261113_001547_carousel' }, ]; diff --git a/src/payload-types.ts b/src/payload-types.ts index 37eabd8..340249d 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -497,6 +497,16 @@ export interface AboutPage { id: number; title: string; content: string; + /** + * Photos in the About page carousel, in order. + */ + carousel?: + | { + photo: number | Media; + alt: string; + id?: string | null; + }[] + | null; updatedAt?: string | null; createdAt?: string | null; } @@ -617,6 +627,13 @@ export interface CalendarSetting { export interface AboutPageSelect { title?: T; content?: T; + carousel?: + | T + | { + photo?: T; + alt?: T; + id?: T; + }; updatedAt?: T; createdAt?: T; globalType?: T; From f780a8917b5827c7c6b746c98492a5c018370e17 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:31:57 +0000 Subject: [PATCH 3/6] feat(about): read carousel photos from Payload, keeping the repo images as fallback --- .../about/_components/AboutClient.tsx | 24 ++++++----------- src/lib/data/carouselFallback.ts | 12 +++++++++ src/lib/data/content.ts | 11 ++++++-- src/lib/data/payload.ts | 26 ++++++++++++++++++- src/lib/data/sheet.ts | 5 ++++ 5 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 src/lib/data/carouselFallback.ts diff --git a/src/app/(frontend)/about/_components/AboutClient.tsx b/src/app/(frontend)/about/_components/AboutClient.tsx index a896ac6..4b5436e 100644 --- a/src/app/(frontend)/about/_components/AboutClient.tsx +++ b/src/app/(frontend)/about/_components/AboutClient.tsx @@ -3,21 +3,13 @@ import { useEffect } from "react"; import { useLanguage } from "@/context/LanguageContext"; import Carousel from "@/components/ui/Carousel"; -import { BilingualPage } from "@/lib/data/content"; +import type { BilingualPage, CarouselPhoto } from "@/lib/data/content"; -const carouselImages = [ - "/images/carousel/argentic.jpg", - "/images/carousel/posing.jpg", - "/images/carousel/leaving.jpg", - "/images/carousel/yesday.jpg", -]; -const carouselAlts = [ - "Band portrait inside an abandoned warehouse", - "Band posing together in dilapidated building", - "Band leaving the warehouse after rehearsal and shoot", - "Still of the band in Yes Day music video shoot", -]; -export default function AboutClient({ french, english }: BilingualPage) { +export default function AboutClient({ + french, + english, + carousel, +}: BilingualPage & { carousel: CarouselPhoto[] }) { const { isFrench } = useLanguage(); const pageContent = isFrench ? french : english; @@ -40,8 +32,8 @@ export default function AboutClient({ french, english }: BilingualPage) {

{pageContent.title}

{pageContent.content}

src)} + altTexts={carousel.map(({ alt }) => (isFrench ? alt.french : alt.english))} caption={ isFrench ? "Galerie de photos du groupe" : "Band photo gallery" } diff --git a/src/lib/data/carouselFallback.ts b/src/lib/data/carouselFallback.ts new file mode 100644 index 0000000..a9786ed --- /dev/null +++ b/src/lib/data/carouselFallback.ts @@ -0,0 +1,12 @@ +import type { CarouselPhoto } from "./sheet"; + +/** Shown until the About page has photos in Payload; delete with public/images/carousel/. */ +export const fallbackCarousel: CarouselPhoto[] = [ + ["argentic", "Band portrait inside an abandoned warehouse"], + ["posing", "Band posing together in dilapidated building"], + ["leaving", "Band leaving the warehouse after rehearsal and shoot"], + ["yesday", "Still of the band in Yes Day music video shoot"], +].map(([name, alt]) => ({ + src: `/images/carousel/${name}.jpg`, + alt: { english: alt, french: alt }, +})); diff --git a/src/lib/data/content.ts b/src/lib/data/content.ts index 2a9268c..f7fb416 100644 --- a/src/lib/data/content.ts +++ b/src/lib/data/content.ts @@ -1,8 +1,9 @@ import { cacheLife, cacheTag } from "next/cache"; +import { fallbackCarousel } from "./carouselFallback"; import * as payloadSource from "./payload"; import * as sheetSource from "./sheet"; -export type { BilingualPage } from "./sheet"; +export type { BilingualPage, CarouselPhoto } from "./sheet"; // Production reads the sheet until DATABASE_URL is set there (switchover step 4). const source = process.env.DATABASE_URL ? payloadSource : sheetSource; @@ -11,7 +12,13 @@ export async function getAboutPage() { "use cache"; cacheLife("minutes"); cacheTag("about"); - return source.getAboutPage(); + const carousel = process.env.DATABASE_URL + ? await payloadSource.getCarousel() + : []; + return { + ...(await source.getAboutPage()), + carousel: carousel.length ? carousel : fallbackCarousel, + }; } export async function getTourPage() { diff --git a/src/lib/data/payload.ts b/src/lib/data/payload.ts index 354a23d..13794c9 100644 --- a/src/lib/data/payload.ts +++ b/src/lib/data/payload.ts @@ -1,7 +1,7 @@ import { getPayload } from "payload"; import config from "../../payload.config"; import type { IFrameProps, LyricsProps, TourDateType } from "../../utils/types"; -import type { BilingualPage } from "./sheet"; +import type { BilingualPage, CarouselPhoto } from "./sheet"; const locales = ["en", "fr"] as const; const read = { depth: 0, fallbackLocale: "en", limit: 0, pagination: false } as const; @@ -24,6 +24,30 @@ async function getPageCopy( return { french: copy(french), english: copy(english) }; } +export async function getCarousel(): Promise { + const payload = await getPayload({ config }); + const [english, french] = await Promise.all( + locales.map((locale) => + payload.findGlobal({ + slug: "about-page", + locale, + depth: 1, + fallbackLocale: "en", + }) + ) + ); + return (english.carousel ?? []).flatMap(({ photo, alt }, index) => + typeof photo === "object" && photo.url + ? [ + { + src: photo.url, + alt: { english: alt, french: french.carousel?.[index]?.alt ?? alt }, + }, + ] + : [] + ); +} + export const getAboutPage = () => getPageCopy("about-page"); export const getTourPage = () => getPageCopy("tour-page"); diff --git a/src/lib/data/sheet.ts b/src/lib/data/sheet.ts index 001af6b..271ea91 100644 --- a/src/lib/data/sheet.ts +++ b/src/lib/data/sheet.ts @@ -13,6 +13,11 @@ export interface BilingualPage { english: Page; } +export interface CarouselPhoto { + src: string; + alt: { english: string; french: string }; +} + async function getPage(tabGid: number): Promise { const [french, english] = parsePageCsv(await fetchSheet(tabGid)); if (!french || !english) { From 6d39ddbc9233a5baf5ca6ed28104ff209bc32f52 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:32:04 +0000 Subject: [PATCH 4/6] feat(import): import the four carousel photos into Payload --- src/scripts/importSheet.ts | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/scripts/importSheet.ts b/src/scripts/importSheet.ts index 9cc313e..5d0e177 100644 --- a/src/scripts/importSheet.ts +++ b/src/scripts/importSheet.ts @@ -1,6 +1,8 @@ import { getPayload } from "payload"; +import path from "path"; import Papa from "papaparse"; import config from "../payload.config"; +import { fallbackCarousel } from "../lib/data/carouselFallback"; import fetchSheet from "../utils/fetchSheet"; import parsePageCsv from "../utils/parsePageCsv"; import type { IFrameProps, LyricsProps, TourDateType } from "../utils/types"; @@ -38,6 +40,54 @@ async function importPages() { } } +async function importCarousel() { + const about = await payload.findGlobal({ slug: "about-page", depth: 0 }); + if (about.carousel?.length) { + console.log(`carousel: ${about.carousel.length} photos already there, skipped`); + return; + } + const photos: number[] = []; + for (const { src, alt } of fallbackCarousel) { + const filename = path.basename(src); + const { docs } = await payload.find({ + collection: "media", + where: { filename: { equals: filename } }, + limit: 1, + depth: 0, + }); + const id = + docs[0]?.id ?? + ( + await payload.create({ + collection: "media", + data: { alt: alt.english }, + filePath: path.resolve("public", src.slice(1)), + context: { ...context }, + }) + ).id; + photos.push(id); + } + for (const [locale, key] of [ + ["en", "english"], + ["fr", "french"], + ] as const) { + const current = await payload.findGlobal({ slug: "about-page", depth: 0 }); + await payload.updateGlobal({ + slug: "about-page", + locale, + data: { + carousel: photos.map((photo, index) => ({ + id: current.carousel?.[index]?.id, + photo, + alt: fallbackCarousel[index].alt[key], + })), + }, + context, + }); + } + console.log("carousel:", photos.length, "photos imported"); +} + async function importTourDates() { const rows = parseRows(await fetchSheet(572869052)).filter( (row) => !!row.eventDate @@ -181,6 +231,7 @@ async function importLyrics() { } await importPages(); +await importCarousel(); await importTourDates(); await importMusicItems(); await importLyrics(); From 5ea9c4ed8ee1b8b4fa632d8c2972fd0ecd0f3f79 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:44:20 +0000 Subject: [PATCH 5/6] fix(media): accept only the image types the server re-encodes as a still JPEG --- src/collections/Media.ts | 8 ++++++-- src/lib/payload/compressImage.ts | 6 ++---- src/lib/payload/imageLimits.ts | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/collections/Media.ts b/src/collections/Media.ts index af2334c..3fdae49 100644 --- a/src/collections/Media.ts +++ b/src/collections/Media.ts @@ -1,5 +1,9 @@ import type { CollectionConfig } from "payload"; -import { jpegQuality, maxImageSide } from "../lib/payload/imageLimits"; +import { + imageMimeTypes, + jpegQuality, + maxImageSide, +} from "../lib/payload/imageLimits"; export const Media: CollectionConfig = { slug: "media", @@ -27,7 +31,7 @@ export const Media: CollectionConfig = { }, ], upload: { - mimeTypes: ["image/*"], + mimeTypes: imageMimeTypes, resizeOptions: { width: maxImageSide, height: maxImageSide, diff --git a/src/lib/payload/compressImage.ts b/src/lib/payload/compressImage.ts index 0072ed1..4490b18 100644 --- a/src/lib/payload/compressImage.ts +++ b/src/lib/payload/compressImage.ts @@ -1,10 +1,8 @@ -import { jpegQuality, maxImageSide } from "./imageLimits"; - -const compressible = ["image/jpeg", "image/png", "image/webp"]; +import { imageMimeTypes, jpegQuality, maxImageSide } from "./imageLimits"; /** Resizes to at most maxImageSide on the long side (never enlarged) and re-encodes as JPEG with jSquash. */ export async function compressImage(file: File): Promise { - if (!compressible.includes(file.type)) return file; + if (!imageMimeTypes.includes(file.type)) return file; const [{ default: encode }, { default: resize }] = await Promise.all([ import("@jsquash/jpeg/encode"), import("@jsquash/resize"), diff --git a/src/lib/payload/imageLimits.ts b/src/lib/payload/imageLimits.ts index 00eadac..b008391 100644 --- a/src/lib/payload/imageLimits.ts +++ b/src/lib/payload/imageLimits.ts @@ -1,2 +1,4 @@ export const maxImageSide = 2560; export const jpegQuality = 80; +/** The formats both the browser and the server can re-encode as a still JPEG. */ +export const imageMimeTypes = ["image/jpeg", "image/png", "image/webp"]; From 247afdaf2c0dc836f2672118d34324b0a87d2d67 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:44:21 +0000 Subject: [PATCH 6/6] fix(media): keep a newly picked file when an earlier compression finishes late --- src/components/payload/ImageCompressor.tsx | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/components/payload/ImageCompressor.tsx b/src/components/payload/ImageCompressor.tsx index 9fcc562..5fce6f8 100644 --- a/src/components/payload/ImageCompressor.tsx +++ b/src/components/payload/ImageCompressor.tsx @@ -18,7 +18,7 @@ type Outcome = export const ImageCompressor: UIFieldClientComponent = () => { const { value: file, setValue } = useField({ path: "file" }); - const { setProcessing } = useForm(); + const { getField, setProcessing } = useForm(); const [outcome, setOutcome] = useState(null); useEffect(() => { @@ -26,19 +26,26 @@ export const ImageCompressor: UIFieldClientComponent = () => { handled.add(file); setProcessing(true); compressImage(file) + .catch(() => null) .then((compressed) => { - handled.add(compressed); - if (compressed === file) return; - setValue(compressed); - setOutcome({ - status: "done", - original: file.size, - compressed: compressed.size, - }); - }) - .catch(() => setOutcome({ status: "failed" })) - .finally(() => setProcessing(false)); - }, [file, setValue, setProcessing]); + if (compressed) handled.add(compressed); + const current = getField("file")?.value; + // A file picked while this one was compressing owns the form now. + if (current instanceof File && current !== file) return; + setProcessing(false); + if (current !== file) return; + if (!compressed) { + setOutcome({ status: "failed" }); + } else if (compressed !== file) { + setValue(compressed); + setOutcome({ + status: "done", + original: file.size, + compressed: compressed.size, + }); + } + }); + }, [file, getField, setValue, setProcessing]); if (!outcome) return null;