diff --git a/scripts/patchLegalVersions.ts b/scripts/patchVersions.ts similarity index 60% rename from scripts/patchLegalVersions.ts rename to scripts/patchVersions.ts index 281c7e21..226986f4 100644 --- a/scripts/patchLegalVersions.ts +++ b/scripts/patchVersions.ts @@ -1,26 +1,32 @@ import { getPayloadClient } from "../src/payloadClient"; -const COLLECTION_TO_UPDATE = "some-collection"; // change this to the collection you want to update +const COLLECTION_TO_UPDATE = "events"; // change this to the collection you want to update +const EXPECTED_STATUS: "published" | "draft" = "published"; /** * Need to enable versioning for an existing collection? * See https://github.com/payloadcms/payload/discussions/5353 + * + * This script should not be run standalone, unless you need to do local testing. + * To update a remote database, this file serves as a template and the below code + * should be copied to a migration file. */ async function patchCollectionVersioning() { try { const payload = await getPayloadClient(); - // patch all documents to draft status + // patch all documents to expected status const result = await payload.update({ collection: COLLECTION_TO_UPDATE, where: {}, data: { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - _status is a system field but we need to set it - _status: "draft", + _status: EXPECTED_STATUS, }, }); - console.log(`Successfully patched ${result.docs.length} documents to draft status.`); + console.log(`Successfully patched ${result.docs.length} documents to ${EXPECTED_STATUS} status.`); console.log("This will trigger the versioning system to populate the versions collection."); process.exit(0); } catch (error) { diff --git a/src/collections/Events.ts b/src/collections/Events.ts index af0e2a99..3810a8bb 100644 --- a/src/collections/Events.ts +++ b/src/collections/Events.ts @@ -14,6 +14,10 @@ export const Events: CollectionConfig = { url: ({ data }) => `${process.env.NEXT_PUBLIC_SERVER_URL}/events/${data.slug}`, }, }, + versions: { + drafts: true, + maxPerDoc: 20, + }, access: { create: canEditContent, delete: canEditContent, diff --git a/src/migrations/20250409_185348_versioning_drafts_events.json b/src/migrations/20250409_185348_versioning_drafts_events.json new file mode 100644 index 00000000..4141d340 --- /dev/null +++ b/src/migrations/20250409_185348_versioning_drafts_events.json @@ -0,0 +1,5623 @@ +{ + "id": "05b17fe5-100e-42ea-96b7-4e6746289f4e", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "enum_users_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'contentEditor'" + }, + "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 + }, + "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 + }, + "alt": { + "name": "alt", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "alt_fr": { + "name": "alt_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "purpose": { + "name": "purpose", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "prefix": { + "name": "prefix", + "type": "varchar", + "primaryKey": false, + "notNull": false, + "default": "'media'" + }, + "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.pages": { + "name": "pages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "seo_description": { + "name": "seo_description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "seo_description_fr": { + "name": "seo_description_fr", + "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": { + "pages_slug_idx": { + "name": "pages_slug_idx", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pages_updated_at_idx": { + "name": "pages_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pages_created_at_idx": { + "name": "pages_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.legal": { + "name": "legal", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "page_id": { + "name": "page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "content_fr": { + "name": "content_fr", + "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()" + }, + "_status": { + "name": "_status", + "type": "enum_legal_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + } + }, + "indexes": { + "legal_page_idx": { + "name": "legal_page_idx", + "columns": [ + { + "expression": "page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "legal_updated_at_idx": { + "name": "legal_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "legal_created_at_idx": { + "name": "legal_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "legal__status_idx": { + "name": "legal__status_idx", + "columns": [ + { + "expression": "_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "legal_page_id_pages_id_fk": { + "name": "legal_page_id_pages_id_fk", + "tableFrom": "legal", + "tableTo": "pages", + "columnsFrom": ["page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._legal_v": { + "name": "_legal_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_page_id": { + "name": "version_page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_content": { + "name": "version_content", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "version_content_fr": { + "name": "version_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version__status": { + "name": "version__status", + "type": "enum__legal_v_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "latest": { + "name": "latest", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_legal_v_parent_idx": { + "name": "_legal_v_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_version_version_page_idx": { + "name": "_legal_v_version_version_page_idx", + "columns": [ + { + "expression": "version_page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_version_version_updated_at_idx": { + "name": "_legal_v_version_version_updated_at_idx", + "columns": [ + { + "expression": "version_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_version_version_created_at_idx": { + "name": "_legal_v_version_version_created_at_idx", + "columns": [ + { + "expression": "version_created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_version_version__status_idx": { + "name": "_legal_v_version_version__status_idx", + "columns": [ + { + "expression": "version__status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_created_at_idx": { + "name": "_legal_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_updated_at_idx": { + "name": "_legal_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_legal_v_latest_idx": { + "name": "_legal_v_latest_idx", + "columns": [ + { + "expression": "latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_legal_v_parent_id_legal_id_fk": { + "name": "_legal_v_parent_id_legal_id_fk", + "tableFrom": "_legal_v", + "tableTo": "legal", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "_legal_v_version_page_id_pages_id_fk": { + "name": "_legal_v_version_page_id_pages_id_fk", + "tableFrom": "_legal_v", + "tableTo": "pages", + "columnsFrom": ["version_page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events_date_ranges": { + "name": "events_date_ranges", + "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 + }, + "start_date": { + "name": "start_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "events_date_ranges_order_idx": { + "name": "events_date_ranges_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_date_ranges_parent_id_idx": { + "name": "events_date_ranges_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_date_ranges_start_date_idx": { + "name": "events_date_ranges_start_date_idx", + "columns": [ + { + "expression": "start_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_date_ranges_end_date_idx": { + "name": "events_date_ranges_end_date_idx", + "columns": [ + { + "expression": "end_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_date_ranges_parent_id_fk": { + "name": "events_date_ranges_parent_id_fk", + "tableFrom": "events_date_ranges", + "tableTo": "events", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "incentive": { + "name": "incentive", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "incentive_fr": { + "name": "incentive_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "limited_availability": { + "name": "limited_availability", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_chance": { + "name": "is_chance", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_fr": { + "name": "location_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_link": { + "name": "location_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "sign_up_link": { + "name": "sign_up_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "instagram_post": { + "name": "instagram_post", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_id": { + "name": "graphic_id", + "type": "integer", + "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()" + }, + "_status": { + "name": "_status", + "type": "enum_events_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + } + }, + "indexes": { + "events_slug_idx": { + "name": "events_slug_idx", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_graphic_idx": { + "name": "events_graphic_idx", + "columns": [ + { + "expression": "graphic_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_updated_at_idx": { + "name": "events_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events_created_at_idx": { + "name": "events_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "events__status_idx": { + "name": "events__status_idx", + "columns": [ + { + "expression": "_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_graphic_id_media_id_fk": { + "name": "events_graphic_id_media_id_fk", + "tableFrom": "events", + "tableTo": "media", + "columnsFrom": ["graphic_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._events_v_version_date_ranges": { + "name": "_events_v_version_date_ranges", + "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": "serial", + "primaryKey": true, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "_uuid": { + "name": "_uuid", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_events_v_version_date_ranges_order_idx": { + "name": "_events_v_version_date_ranges_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_date_ranges_parent_id_idx": { + "name": "_events_v_version_date_ranges_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_date_ranges_start_date_idx": { + "name": "_events_v_version_date_ranges_start_date_idx", + "columns": [ + { + "expression": "start_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_date_ranges_end_date_idx": { + "name": "_events_v_version_date_ranges_end_date_idx", + "columns": [ + { + "expression": "end_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_events_v_version_date_ranges_parent_id_fk": { + "name": "_events_v_version_date_ranges_parent_id_fk", + "tableFrom": "_events_v_version_date_ranges", + "tableTo": "_events_v", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._events_v": { + "name": "_events_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_slug": { + "name": "version_slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_title": { + "name": "version_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_title_fr": { + "name": "version_title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_description": { + "name": "version_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_description_fr": { + "name": "version_description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_incentive": { + "name": "version_incentive", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_incentive_fr": { + "name": "version_incentive_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_limited_availability": { + "name": "version_limited_availability", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "version_is_chance": { + "name": "version_is_chance", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "version_location": { + "name": "version_location", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_location_fr": { + "name": "version_location_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_location_link": { + "name": "version_location_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_sign_up_link": { + "name": "version_sign_up_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_instagram_post": { + "name": "version_instagram_post", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_graphic_id": { + "name": "version_graphic_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version__status": { + "name": "version__status", + "type": "enum__events_v_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "latest": { + "name": "latest", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_events_v_parent_idx": { + "name": "_events_v_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_version_slug_idx": { + "name": "_events_v_version_version_slug_idx", + "columns": [ + { + "expression": "version_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_version_graphic_idx": { + "name": "_events_v_version_version_graphic_idx", + "columns": [ + { + "expression": "version_graphic_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_version_updated_at_idx": { + "name": "_events_v_version_version_updated_at_idx", + "columns": [ + { + "expression": "version_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_version_created_at_idx": { + "name": "_events_v_version_version_created_at_idx", + "columns": [ + { + "expression": "version_created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_version_version__status_idx": { + "name": "_events_v_version_version__status_idx", + "columns": [ + { + "expression": "version__status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_created_at_idx": { + "name": "_events_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_updated_at_idx": { + "name": "_events_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_events_v_latest_idx": { + "name": "_events_v_latest_idx", + "columns": [ + { + "expression": "latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_events_v_parent_id_events_id_fk": { + "name": "_events_v_parent_id_events_id_fk", + "tableFrom": "_events_v", + "tableTo": "events", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "_events_v_version_graphic_id_media_id_fk": { + "name": "_events_v_version_graphic_id_media_id_fk", + "tableFrom": "_events_v", + "tableTo": "media", + "columnsFrom": ["version_graphic_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.clubs_other_socials": { + "name": "clubs_other_socials", + "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 + }, + "link": { + "name": "link", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "clubs_other_socials_order_idx": { + "name": "clubs_other_socials_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_other_socials_parent_id_idx": { + "name": "clubs_other_socials_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "clubs_other_socials_parent_id_fk": { + "name": "clubs_other_socials_parent_id_fk", + "tableFrom": "clubs_other_socials", + "tableTo": "clubs", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.clubs": { + "name": "clubs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "newsletter": { + "name": "newsletter", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "facebook": { + "name": "facebook", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "instagram": { + "name": "instagram", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_title": { + "name": "graphic_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_title_fr": { + "name": "graphic_title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_id": { + "name": "graphic_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currently_active": { + "name": "currently_active", + "type": "boolean", + "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": { + "clubs_slug_idx": { + "name": "clubs_slug_idx", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_graphic_idx": { + "name": "clubs_graphic_idx", + "columns": [ + { + "expression": "graphic_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_updated_at_idx": { + "name": "clubs_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_created_at_idx": { + "name": "clubs_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "clubs_graphic_id_media_id_fk": { + "name": "clubs_graphic_id_media_id_fk", + "tableFrom": "clubs", + "tableTo": "media", + "columnsFrom": ["graphic_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.clubs_rels": { + "name": "clubs_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 + }, + "club_tags_id": { + "name": "club_tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "clubs_rels_order_idx": { + "name": "clubs_rels_order_idx", + "columns": [ + { + "expression": "order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_rels_parent_idx": { + "name": "clubs_rels_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_rels_path_idx": { + "name": "clubs_rels_path_idx", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "clubs_rels_club_tags_id_idx": { + "name": "clubs_rels_club_tags_id_idx", + "columns": [ + { + "expression": "club_tags_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "clubs_rels_parent_fk": { + "name": "clubs_rels_parent_fk", + "tableFrom": "clubs_rels", + "tableTo": "clubs", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "clubs_rels_club_tags_fk": { + "name": "clubs_rels_club_tags_fk", + "tableFrom": "clubs_rels", + "tableTo": "club_tags", + "columnsFrom": ["club_tags_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resources_insurance_providers_insurance_provider": { + "name": "resources_insurance_providers_insurance_provider", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name_fr": { + "name": "name_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resources_insurance_providers_insurance_provider_order_idx": { + "name": "resources_insurance_providers_insurance_provider_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_insurance_providers_insurance_provider_parent_id_idx": { + "name": "resources_insurance_providers_insurance_provider_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resources_insurance_providers_insurance_provider_parent_id_fk": { + "name": "resources_insurance_providers_insurance_provider_parent_id_fk", + "tableFrom": "resources_insurance_providers_insurance_provider", + "tableTo": "resources_insurance_providers", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resources_insurance_providers": { + "name": "resources_insurance_providers", + "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 + } + }, + "indexes": { + "resources_insurance_providers_order_idx": { + "name": "resources_insurance_providers_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_insurance_providers_parent_id_idx": { + "name": "resources_insurance_providers_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resources_insurance_providers_parent_id_fk": { + "name": "resources_insurance_providers_parent_id_fk", + "tableFrom": "resources_insurance_providers", + "tableTo": "resources", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resources": { + "name": "resources", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "newsletter": { + "name": "newsletter", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "insurance_details": { + "name": "insurance_details", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "insurance_detail_fr": { + "name": "insurance_detail_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_fr": { + "name": "location_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "channel_online": { + "name": "channel_online", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "channel_telephone": { + "name": "channel_telephone", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "channel_in_person": { + "name": "channel_in_person", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "on_campus": { + "name": "on_campus", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "graphic_title": { + "name": "graphic_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_title_fr": { + "name": "graphic_title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graphic_id": { + "name": "graphic_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currently_active": { + "name": "currently_active", + "type": "boolean", + "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": { + "resources_slug_idx": { + "name": "resources_slug_idx", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_graphic_idx": { + "name": "resources_graphic_idx", + "columns": [ + { + "expression": "graphic_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_updated_at_idx": { + "name": "resources_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_created_at_idx": { + "name": "resources_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resources_graphic_id_media_id_fk": { + "name": "resources_graphic_id_media_id_fk", + "tableFrom": "resources", + "tableTo": "media", + "columnsFrom": ["graphic_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resources_rels": { + "name": "resources_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 + }, + "resource_tags_id": { + "name": "resource_tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resources_rels_order_idx": { + "name": "resources_rels_order_idx", + "columns": [ + { + "expression": "order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_rels_parent_idx": { + "name": "resources_rels_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_rels_path_idx": { + "name": "resources_rels_path_idx", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resources_rels_resource_tags_id_idx": { + "name": "resources_rels_resource_tags_id_idx", + "columns": [ + { + "expression": "resource_tags_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resources_rels_parent_fk": { + "name": "resources_rels_parent_fk", + "tableFrom": "resources_rels", + "tableTo": "resources", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "resources_rels_resource_tags_fk": { + "name": "resources_rels_resource_tags_fk", + "tableFrom": "resources_rels", + "tableTo": "resource_tags", + "columnsFrom": ["resource_tags_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.club_tag_categories": { + "name": "club_tag_categories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "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()" + } + }, + "indexes": { + "club_tag_categories_updated_at_idx": { + "name": "club_tag_categories_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "club_tag_categories_created_at_idx": { + "name": "club_tag_categories_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.resource_tag_categories": { + "name": "resource_tag_categories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "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()" + } + }, + "indexes": { + "resource_tag_categories_updated_at_idx": { + "name": "resource_tag_categories_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_tag_categories_created_at_idx": { + "name": "resource_tag_categories_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.club_tags": { + "name": "club_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "category_id": { + "name": "category_id", + "type": "integer", + "primaryKey": false, + "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()" + } + }, + "indexes": { + "club_tags_category_idx": { + "name": "club_tags_category_idx", + "columns": [ + { + "expression": "category_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "club_tags_updated_at_idx": { + "name": "club_tags_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "club_tags_created_at_idx": { + "name": "club_tags_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "club_tags_category_id_club_tag_categories_id_fk": { + "name": "club_tags_category_id_club_tag_categories_id_fk", + "tableFrom": "club_tags", + "tableTo": "club_tag_categories", + "columnsFrom": ["category_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_tags": { + "name": "resource_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "category_id": { + "name": "category_id", + "type": "integer", + "primaryKey": false, + "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()" + } + }, + "indexes": { + "resource_tags_category_idx": { + "name": "resource_tags_category_idx", + "columns": [ + { + "expression": "category_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_tags_updated_at_idx": { + "name": "resource_tags_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_tags_created_at_idx": { + "name": "resource_tags_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_tags_category_id_resource_tag_categories_id_fk": { + "name": "resource_tags_category_id_resource_tag_categories_id_fk", + "tableFrom": "resource_tags", + "tableTo": "resource_tag_categories", + "columnsFrom": ["category_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "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 + }, + "pages_id": { + "name": "pages_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "legal_id": { + "name": "legal_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "events_id": { + "name": "events_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "clubs_id": { + "name": "clubs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "resources_id": { + "name": "resources_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "club_tag_categories_id": { + "name": "club_tag_categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "resource_tag_categories_id": { + "name": "resource_tag_categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "club_tags_id": { + "name": "club_tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "resource_tags_id": { + "name": "resource_tags_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_pages_id_idx": { + "name": "payload_locked_documents_rels_pages_id_idx", + "columns": [ + { + "expression": "pages_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_legal_id_idx": { + "name": "payload_locked_documents_rels_legal_id_idx", + "columns": [ + { + "expression": "legal_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_events_id_idx": { + "name": "payload_locked_documents_rels_events_id_idx", + "columns": [ + { + "expression": "events_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_clubs_id_idx": { + "name": "payload_locked_documents_rels_clubs_id_idx", + "columns": [ + { + "expression": "clubs_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_resources_id_idx": { + "name": "payload_locked_documents_rels_resources_id_idx", + "columns": [ + { + "expression": "resources_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_club_tag_categories_id_idx": { + "name": "payload_locked_documents_rels_club_tag_categories_id_idx", + "columns": [ + { + "expression": "club_tag_categories_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_resource_tag_categories_id_idx": { + "name": "payload_locked_documents_rels_resource_tag_categories_id_idx", + "columns": [ + { + "expression": "resource_tag_categories_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_club_tags_id_idx": { + "name": "payload_locked_documents_rels_club_tags_id_idx", + "columns": [ + { + "expression": "club_tags_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "payload_locked_documents_rels_resource_tags_id_idx": { + "name": "payload_locked_documents_rels_resource_tags_id_idx", + "columns": [ + { + "expression": "resource_tags_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_pages_fk": { + "name": "payload_locked_documents_rels_pages_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "pages", + "columnsFrom": ["pages_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_legal_fk": { + "name": "payload_locked_documents_rels_legal_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "legal", + "columnsFrom": ["legal_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_events_fk": { + "name": "payload_locked_documents_rels_events_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "events", + "columnsFrom": ["events_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_clubs_fk": { + "name": "payload_locked_documents_rels_clubs_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "clubs", + "columnsFrom": ["clubs_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_resources_fk": { + "name": "payload_locked_documents_rels_resources_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "resources", + "columnsFrom": ["resources_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_club_tag_categories_fk": { + "name": "payload_locked_documents_rels_club_tag_categories_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "club_tag_categories", + "columnsFrom": ["club_tag_categories_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_resource_tag_categories_fk": { + "name": "payload_locked_documents_rels_resource_tag_categories_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "resource_tag_categories", + "columnsFrom": ["resource_tag_categories_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_club_tags_fk": { + "name": "payload_locked_documents_rels_club_tags_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "club_tags", + "columnsFrom": ["club_tags_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_locked_documents_rels_resource_tags_fk": { + "name": "payload_locked_documents_rels_resource_tags_fk", + "tableFrom": "payload_locked_documents_rels", + "tableTo": "resource_tags", + "columnsFrom": ["resource_tags_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.holistic_wellness_wellness_wheel_dimensions": { + "name": "holistic_wellness_wellness_wheel_dimensions", + "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 + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name_fr": { + "name": "name_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "holistic_wellness_wellness_wheel_dimensions_order_idx": { + "name": "holistic_wellness_wellness_wheel_dimensions_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "holistic_wellness_wellness_wheel_dimensions_parent_id_idx": { + "name": "holistic_wellness_wellness_wheel_dimensions_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "holistic_wellness_wellness_wheel_dimensions_parent_id_fk": { + "name": "holistic_wellness_wellness_wheel_dimensions_parent_id_fk", + "tableFrom": "holistic_wellness_wellness_wheel_dimensions", + "tableTo": "holistic_wellness", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.holistic_wellness_sections": { + "name": "holistic_wellness_sections", + "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 + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "content_fr": { + "name": "content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "holistic_wellness_sections_order_idx": { + "name": "holistic_wellness_sections_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "holistic_wellness_sections_parent_id_idx": { + "name": "holistic_wellness_sections_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "holistic_wellness_sections_parent_id_fk": { + "name": "holistic_wellness_sections_parent_id_fk", + "tableFrom": "holistic_wellness_sections", + "tableTo": "holistic_wellness", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.holistic_wellness": { + "name": "holistic_wellness", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "page_id": { + "name": "page_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "hero_content": { + "name": "hero_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "hero_content_fr": { + "name": "hero_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "wellness_wheel_top_content": { + "name": "wellness_wheel_top_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "wellness_wheel_top_content_fr": { + "name": "wellness_wheel_top_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "wellness_wheel_bottom_content": { + "name": "wellness_wheel_bottom_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "wellness_wheel_bottom_content_fr": { + "name": "wellness_wheel_bottom_content_fr", + "type": "jsonb", + "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": { + "holistic_wellness_page_idx": { + "name": "holistic_wellness_page_idx", + "columns": [ + { + "expression": "page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "holistic_wellness_page_id_pages_id_fk": { + "name": "holistic_wellness_page_id_pages_id_fk", + "tableFrom": "holistic_wellness", + "tableTo": "pages", + "columnsFrom": ["page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._holistic_wellness_v_version_wellness_wheel_dimensions": { + "name": "_holistic_wellness_v_version_wellness_wheel_dimensions", + "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": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name_fr": { + "name": "name_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "_uuid": { + "name": "_uuid", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_holistic_wellness_v_version_wellness_wheel_dimensions_order_idx": { + "name": "_holistic_wellness_v_version_wellness_wheel_dimensions_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_holistic_wellness_v_version_wellness_wheel_dimensions_parent_id_idx": { + "name": "_holistic_wellness_v_version_wellness_wheel_dimensions_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_holistic_wellness_v_version_wellness_wheel_dimensions_parent_id_fk": { + "name": "_holistic_wellness_v_version_wellness_wheel_dimensions_parent_id_fk", + "tableFrom": "_holistic_wellness_v_version_wellness_wheel_dimensions", + "tableTo": "_holistic_wellness_v", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._holistic_wellness_v_version_sections": { + "name": "_holistic_wellness_v_version_sections", + "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": "serial", + "primaryKey": true, + "notNull": true + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "content_fr": { + "name": "content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "_uuid": { + "name": "_uuid", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_holistic_wellness_v_version_sections_order_idx": { + "name": "_holistic_wellness_v_version_sections_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_holistic_wellness_v_version_sections_parent_id_idx": { + "name": "_holistic_wellness_v_version_sections_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_holistic_wellness_v_version_sections_parent_id_fk": { + "name": "_holistic_wellness_v_version_sections_parent_id_fk", + "tableFrom": "_holistic_wellness_v_version_sections", + "tableTo": "_holistic_wellness_v", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._holistic_wellness_v": { + "name": "_holistic_wellness_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "version_page_id": { + "name": "version_page_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "version_hero_content": { + "name": "version_hero_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "version_hero_content_fr": { + "name": "version_hero_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "version_wellness_wheel_top_content": { + "name": "version_wellness_wheel_top_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "version_wellness_wheel_top_content_fr": { + "name": "version_wellness_wheel_top_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "version_wellness_wheel_bottom_content": { + "name": "version_wellness_wheel_bottom_content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "version_wellness_wheel_bottom_content_fr": { + "name": "version_wellness_wheel_bottom_content_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_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": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "_holistic_wellness_v_version_version_page_idx": { + "name": "_holistic_wellness_v_version_version_page_idx", + "columns": [ + { + "expression": "version_page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_holistic_wellness_v_created_at_idx": { + "name": "_holistic_wellness_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_holistic_wellness_v_updated_at_idx": { + "name": "_holistic_wellness_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_holistic_wellness_v_version_page_id_pages_id_fk": { + "name": "_holistic_wellness_v_version_page_id_pages_id_fk", + "tableFrom": "_holistic_wellness_v", + "tableTo": "pages", + "columnsFrom": ["version_page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sponsor_sponsors": { + "name": "sponsor_sponsors", + "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 + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "logo_id": { + "name": "logo_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sponsor_sponsors_order_idx": { + "name": "sponsor_sponsors_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sponsor_sponsors_parent_id_idx": { + "name": "sponsor_sponsors_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sponsor_sponsors_logo_idx": { + "name": "sponsor_sponsors_logo_idx", + "columns": [ + { + "expression": "logo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sponsor_sponsors_logo_id_media_id_fk": { + "name": "sponsor_sponsors_logo_id_media_id_fk", + "tableFrom": "sponsor_sponsors", + "tableTo": "media", + "columnsFrom": ["logo_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "sponsor_sponsors_parent_id_fk": { + "name": "sponsor_sponsors_parent_id_fk", + "tableFrom": "sponsor_sponsors", + "tableTo": "sponsor", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sponsor": { + "name": "sponsor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "page_id": { + "name": "page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "our_sponsors_section": { + "name": "our_sponsors_section", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "our_sponsors_section_fr": { + "name": "our_sponsors_section_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "callout": { + "name": "callout", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "callout_fr": { + "name": "callout_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "sponsor_us_section": { + "name": "sponsor_us_section", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "sponsor_us_section_fr": { + "name": "sponsor_us_section_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "_status": { + "name": "_status", + "type": "enum_sponsor_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "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": { + "sponsor_page_idx": { + "name": "sponsor_page_idx", + "columns": [ + { + "expression": "page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sponsor__status_idx": { + "name": "sponsor__status_idx", + "columns": [ + { + "expression": "_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sponsor_page_id_pages_id_fk": { + "name": "sponsor_page_id_pages_id_fk", + "tableFrom": "sponsor", + "tableTo": "pages", + "columnsFrom": ["page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._sponsor_v_version_sponsors": { + "name": "_sponsor_v_version_sponsors", + "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": "serial", + "primaryKey": true, + "notNull": true + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "logo_id": { + "name": "logo_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "_uuid": { + "name": "_uuid", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_sponsor_v_version_sponsors_order_idx": { + "name": "_sponsor_v_version_sponsors_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_version_sponsors_parent_id_idx": { + "name": "_sponsor_v_version_sponsors_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_version_sponsors_logo_idx": { + "name": "_sponsor_v_version_sponsors_logo_idx", + "columns": [ + { + "expression": "logo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_sponsor_v_version_sponsors_logo_id_media_id_fk": { + "name": "_sponsor_v_version_sponsors_logo_id_media_id_fk", + "tableFrom": "_sponsor_v_version_sponsors", + "tableTo": "media", + "columnsFrom": ["logo_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "_sponsor_v_version_sponsors_parent_id_fk": { + "name": "_sponsor_v_version_sponsors_parent_id_fk", + "tableFrom": "_sponsor_v_version_sponsors", + "tableTo": "_sponsor_v", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._sponsor_v": { + "name": "_sponsor_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "version_page_id": { + "name": "version_page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_our_sponsors_section": { + "name": "version_our_sponsors_section", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_our_sponsors_section_fr": { + "name": "version_our_sponsors_section_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_callout": { + "name": "version_callout", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_callout_fr": { + "name": "version_callout_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_sponsor_us_section": { + "name": "version_sponsor_us_section", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_sponsor_us_section_fr": { + "name": "version_sponsor_us_section_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version__status": { + "name": "version__status", + "type": "enum__sponsor_v_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_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": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "latest": { + "name": "latest", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_sponsor_v_version_version_page_idx": { + "name": "_sponsor_v_version_version_page_idx", + "columns": [ + { + "expression": "version_page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_version_version__status_idx": { + "name": "_sponsor_v_version_version__status_idx", + "columns": [ + { + "expression": "version__status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_created_at_idx": { + "name": "_sponsor_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_updated_at_idx": { + "name": "_sponsor_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_sponsor_v_latest_idx": { + "name": "_sponsor_v_latest_idx", + "columns": [ + { + "expression": "latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_sponsor_v_version_page_id_pages_id_fk": { + "name": "_sponsor_v_version_page_id_pages_id_fk", + "tableFrom": "_sponsor_v", + "tableTo": "pages", + "columnsFrom": ["version_page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.volunteer_positions": { + "name": "volunteer_positions", + "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 + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "description_fr": { + "name": "description_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements_fr": { + "name": "requirements_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "time_commitment": { + "name": "time_commitment", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "time_commitment_fr": { + "name": "time_commitment_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "date_posted": { + "name": "date_posted", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "form_link": { + "name": "form_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_open": { + "name": "is_open", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + } + }, + "indexes": { + "volunteer_positions_order_idx": { + "name": "volunteer_positions_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "volunteer_positions_parent_id_idx": { + "name": "volunteer_positions_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "volunteer_positions_parent_id_fk": { + "name": "volunteer_positions_parent_id_fk", + "tableFrom": "volunteer_positions", + "tableTo": "volunteer", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.volunteer": { + "name": "volunteer", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "page_id": { + "name": "page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description_fr": { + "name": "description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "_status": { + "name": "_status", + "type": "enum_volunteer_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "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": { + "volunteer_page_idx": { + "name": "volunteer_page_idx", + "columns": [ + { + "expression": "page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "volunteer__status_idx": { + "name": "volunteer__status_idx", + "columns": [ + { + "expression": "_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "volunteer_page_id_pages_id_fk": { + "name": "volunteer_page_id_pages_id_fk", + "tableFrom": "volunteer", + "tableTo": "pages", + "columnsFrom": ["page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._volunteer_v_version_positions": { + "name": "_volunteer_v_version_positions", + "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": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "title_fr": { + "name": "title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "description_fr": { + "name": "description_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements": { + "name": "requirements", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "requirements_fr": { + "name": "requirements_fr", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "time_commitment": { + "name": "time_commitment", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "time_commitment_fr": { + "name": "time_commitment_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "date_posted": { + "name": "date_posted", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "form_link": { + "name": "form_link", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_open": { + "name": "is_open", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "_uuid": { + "name": "_uuid", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_volunteer_v_version_positions_order_idx": { + "name": "_volunteer_v_version_positions_order_idx", + "columns": [ + { + "expression": "_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_volunteer_v_version_positions_parent_id_idx": { + "name": "_volunteer_v_version_positions_parent_id_idx", + "columns": [ + { + "expression": "_parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_volunteer_v_version_positions_parent_id_fk": { + "name": "_volunteer_v_version_positions_parent_id_fk", + "tableFrom": "_volunteer_v_version_positions", + "tableTo": "_volunteer_v", + "columnsFrom": ["_parent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._volunteer_v": { + "name": "_volunteer_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "version_page_id": { + "name": "version_page_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version_title": { + "name": "version_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_title_fr": { + "name": "version_title_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_description": { + "name": "version_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_description_fr": { + "name": "version_description_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version__status": { + "name": "version__status", + "type": "enum__volunteer_v_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_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": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "latest": { + "name": "latest", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_volunteer_v_version_version_page_idx": { + "name": "_volunteer_v_version_version_page_idx", + "columns": [ + { + "expression": "version_page_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_volunteer_v_version_version__status_idx": { + "name": "_volunteer_v_version_version__status_idx", + "columns": [ + { + "expression": "version__status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_volunteer_v_created_at_idx": { + "name": "_volunteer_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_volunteer_v_updated_at_idx": { + "name": "_volunteer_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_volunteer_v_latest_idx": { + "name": "_volunteer_v_latest_idx", + "columns": [ + { + "expression": "latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "_volunteer_v_version_page_id_pages_id_fk": { + "name": "_volunteer_v_version_page_id_pages_id_fk", + "tableFrom": "_volunteer_v", + "tableTo": "pages", + "columnsFrom": ["version_page_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.announcement_bar": { + "name": "announcement_bar", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "is_enabled": { + "name": "is_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "message": { + "name": "message", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "message_fr": { + "name": "message_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "link_text": { + "name": "link_text", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "link_text_fr": { + "name": "link_text_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "link_href": { + "name": "link_href", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "_status": { + "name": "_status", + "type": "enum_announcement_bar_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "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": { + "announcement_bar__status_idx": { + "name": "announcement_bar__status_idx", + "columns": [ + { + "expression": "_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public._announcement_bar_v": { + "name": "_announcement_bar_v", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "version_is_enabled": { + "name": "version_is_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "version_message": { + "name": "version_message", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_message_fr": { + "name": "version_message_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_link_text": { + "name": "version_link_text", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_link_text_fr": { + "name": "version_link_text_fr", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version_link_href": { + "name": "version_link_href", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "version__status": { + "name": "version__status", + "type": "enum__announcement_bar_v_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "version_updated_at": { + "name": "version_updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "version_created_at": { + "name": "version_created_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": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "latest": { + "name": "latest", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "_announcement_bar_v_version_version__status_idx": { + "name": "_announcement_bar_v_version_version__status_idx", + "columns": [ + { + "expression": "version__status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_announcement_bar_v_created_at_idx": { + "name": "_announcement_bar_v_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_announcement_bar_v_updated_at_idx": { + "name": "_announcement_bar_v_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "_announcement_bar_v_latest_idx": { + "name": "_announcement_bar_v_latest_idx", + "columns": [ + { + "expression": "latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.enum_users_role": { + "name": "enum_users_role", + "schema": "public", + "values": ["admin", "contentEditor", "contentEditorFr"] + }, + "public.enum_legal_status": { + "name": "enum_legal_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum__legal_v_version_status": { + "name": "enum__legal_v_version_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum_events_status": { + "name": "enum_events_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum__events_v_version_status": { + "name": "enum__events_v_version_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum_sponsor_status": { + "name": "enum_sponsor_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum__sponsor_v_version_status": { + "name": "enum__sponsor_v_version_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum_volunteer_status": { + "name": "enum_volunteer_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum__volunteer_v_version_status": { + "name": "enum__volunteer_v_version_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum_announcement_bar_status": { + "name": "enum_announcement_bar_status", + "schema": "public", + "values": ["draft", "published"] + }, + "public.enum__announcement_bar_v_version_status": { + "name": "enum__announcement_bar_v_version_status", + "schema": "public", + "values": ["draft", "published"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} diff --git a/src/migrations/20250409_185348_versioning_drafts_events.ts b/src/migrations/20250409_185348_versioning_drafts_events.ts new file mode 100644 index 00000000..21fdc263 --- /dev/null +++ b/src/migrations/20250409_185348_versioning_drafts_events.ts @@ -0,0 +1,115 @@ +import { MigrateUpArgs, MigrateDownArgs, sql } from "@payloadcms/db-postgres"; + +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` + CREATE TYPE "public"."enum_events_status" AS ENUM('draft', 'published'); + CREATE TYPE "public"."enum__events_v_version_status" AS ENUM('draft', 'published'); + CREATE TABLE IF NOT EXISTS "_events_v_version_date_ranges" ( + "_order" integer NOT NULL, + "_parent_id" integer NOT NULL, + "id" serial PRIMARY KEY NOT NULL, + "start_date" timestamp(3) with time zone, + "end_date" timestamp(3) with time zone, + "_uuid" varchar + ); + + CREATE TABLE IF NOT EXISTS "_events_v" ( + "id" serial PRIMARY KEY NOT NULL, + "parent_id" integer, + "version_slug" varchar, + "version_title" varchar, + "version_title_fr" varchar, + "version_description" varchar, + "version_description_fr" varchar, + "version_incentive" varchar, + "version_incentive_fr" varchar, + "version_limited_availability" boolean, + "version_is_chance" boolean, + "version_location" varchar, + "version_location_fr" varchar, + "version_location_link" varchar, + "version_sign_up_link" varchar, + "version_instagram_post" varchar, + "version_graphic_id" integer, + "version_updated_at" timestamp(3) with time zone, + "version_created_at" timestamp(3) with time zone, + "version__status" "enum__events_v_version_status" DEFAULT 'draft', + "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "latest" boolean + ); + + ALTER TABLE "events_date_ranges" ALTER COLUMN "start_date" DROP NOT NULL; + ALTER TABLE "events_date_ranges" ALTER COLUMN "end_date" DROP NOT NULL; + ALTER TABLE "events" ALTER COLUMN "slug" DROP NOT NULL; + ALTER TABLE "events" ALTER COLUMN "title" DROP NOT NULL; + ALTER TABLE "events" ALTER COLUMN "description" DROP NOT NULL; + ALTER TABLE "events" ALTER COLUMN "location" DROP NOT NULL; + ALTER TABLE "events" ADD COLUMN "_status" "enum_events_status" DEFAULT 'draft'; + DO $$ BEGIN + ALTER TABLE "_events_v_version_date_ranges" ADD CONSTRAINT "_events_v_version_date_ranges_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_events_v"("id") ON DELETE cascade ON UPDATE no action; + EXCEPTION + WHEN duplicate_object THEN null; + END $$; + + DO $$ BEGIN + ALTER TABLE "_events_v" ADD CONSTRAINT "_events_v_parent_id_events_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."events"("id") ON DELETE set null ON UPDATE no action; + EXCEPTION + WHEN duplicate_object THEN null; + END $$; + + DO $$ BEGIN + ALTER TABLE "_events_v" ADD CONSTRAINT "_events_v_version_graphic_id_media_id_fk" FOREIGN KEY ("version_graphic_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; + EXCEPTION + WHEN duplicate_object THEN null; + END $$; + + CREATE INDEX IF NOT EXISTS "_events_v_version_date_ranges_order_idx" ON "_events_v_version_date_ranges" USING btree ("_order"); + CREATE INDEX IF NOT EXISTS "_events_v_version_date_ranges_parent_id_idx" ON "_events_v_version_date_ranges" USING btree ("_parent_id"); + CREATE INDEX IF NOT EXISTS "_events_v_version_date_ranges_start_date_idx" ON "_events_v_version_date_ranges" USING btree ("start_date"); + CREATE INDEX IF NOT EXISTS "_events_v_version_date_ranges_end_date_idx" ON "_events_v_version_date_ranges" USING btree ("end_date"); + CREATE INDEX IF NOT EXISTS "_events_v_parent_idx" ON "_events_v" USING btree ("parent_id"); + CREATE INDEX IF NOT EXISTS "_events_v_version_version_slug_idx" ON "_events_v" USING btree ("version_slug"); + CREATE INDEX IF NOT EXISTS "_events_v_version_version_graphic_idx" ON "_events_v" USING btree ("version_graphic_id"); + CREATE INDEX IF NOT EXISTS "_events_v_version_version_updated_at_idx" ON "_events_v" USING btree ("version_updated_at"); + CREATE INDEX IF NOT EXISTS "_events_v_version_version_created_at_idx" ON "_events_v" USING btree ("version_created_at"); + CREATE INDEX IF NOT EXISTS "_events_v_version_version__status_idx" ON "_events_v" USING btree ("version__status"); + CREATE INDEX IF NOT EXISTS "_events_v_created_at_idx" ON "_events_v" USING btree ("created_at"); + CREATE INDEX IF NOT EXISTS "_events_v_updated_at_idx" ON "_events_v" USING btree ("updated_at"); + CREATE INDEX IF NOT EXISTS "_events_v_latest_idx" ON "_events_v" USING btree ("latest"); + CREATE INDEX IF NOT EXISTS "events__status_idx" ON "events" USING btree ("_status");`); + + // patch all existing events documents to 'published' to trigger versioning + try { + const result = await payload.update({ + collection: "events", + where: {}, + data: { + _status: "published", + }, + }); + console.log(`Successfully patched ${result.docs.length} documents to published status.`); + console.log("This will trigger the versioning system to populate the versions collection."); + } catch (error) { + console.error("Error patching documents during migration:", error); + throw error; + } +} + +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` + ALTER TABLE "_events_v_version_date_ranges" DISABLE ROW LEVEL SECURITY; + ALTER TABLE "_events_v" DISABLE ROW LEVEL SECURITY; + DROP TABLE "_events_v_version_date_ranges" CASCADE; + DROP TABLE "_events_v" CASCADE; + DROP INDEX IF EXISTS "events__status_idx"; + ALTER TABLE "events_date_ranges" ALTER COLUMN "start_date" SET NOT NULL; + ALTER TABLE "events_date_ranges" ALTER COLUMN "end_date" SET NOT NULL; + ALTER TABLE "events" ALTER COLUMN "slug" SET NOT NULL; + ALTER TABLE "events" ALTER COLUMN "title" SET NOT NULL; + ALTER TABLE "events" ALTER COLUMN "description" SET NOT NULL; + ALTER TABLE "events" ALTER COLUMN "location" SET NOT NULL; + ALTER TABLE "events" DROP COLUMN IF EXISTS "_status"; + DROP TYPE "public"."enum_events_status"; + DROP TYPE "public"."enum__events_v_version_status";`); +} diff --git a/src/migrations/index.ts b/src/migrations/index.ts index a33ddd2f..baf588a3 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -12,4 +12,4 @@ export const migrations = [ down: migration_20250430_051055_sentinel.down, name: "20250430_051055_sentinel", }, -]; +]; \ No newline at end of file diff --git a/src/payload-types.ts b/src/payload-types.ts index d8b43390..e54f0eca 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -291,6 +291,7 @@ export interface Event { graphic?: (number | null) | Media; updatedAt: string; createdAt: string; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -630,6 +631,7 @@ export interface EventsSelect { graphic?: T; updatedAt?: T; createdAt?: T; + _status?: T; } /** * This interface was referenced by `Config`'s JSON-Schema diff --git a/tsconfig.json b/tsconfig.json index 752e6069..780f3d1d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,5 +29,5 @@ "target": "ES2022" }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules", "scripts"] + "exclude": ["node_modules", "scripts", "src/migrations"] }