From 2a8c46c4fa876f0134f5851c2416516fded7fdd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Thu, 17 Oct 2024 11:07:58 +0200 Subject: [PATCH] feat: create ApiKey collection --- webapp/CHANGELOG.md | 3 +- webapp/src/payload/collections/ApiKey.ts | 20 + .../payload/migrations/20241017_090729.json | 3730 +++++++++++++++++ .../src/payload/migrations/20241017_090729.ts | 24 + webapp/src/payload/payload.config.ts | 2 + 5 files changed, 3777 insertions(+), 2 deletions(-) create mode 100644 webapp/src/payload/collections/ApiKey.ts create mode 100644 webapp/src/payload/migrations/20241017_090729.json create mode 100644 webapp/src/payload/migrations/20241017_090729.ts diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index 655182e6..148825a6 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,9 +1,8 @@ # [0.42.0](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.41.0...v0.42.0) (2024-10-16) - ### Features -* add categories textWhite option ([e2bfb36](https://github.com/SocialGouv/carte-jeune-engage/commit/e2bfb36be267790115570e3023845b48824eaabc)) +- add categories textWhite option ([e2bfb36](https://github.com/SocialGouv/carte-jeune-engage/commit/e2bfb36be267790115570e3023845b48824eaabc)) # [0.41.0](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.40.4...v0.41.0) (2024-10-16) diff --git a/webapp/src/payload/collections/ApiKey.ts b/webapp/src/payload/collections/ApiKey.ts new file mode 100644 index 00000000..f4a4886b --- /dev/null +++ b/webapp/src/payload/collections/ApiKey.ts @@ -0,0 +1,20 @@ +import { type CollectionConfig } from "payload/types"; + +export const ApiKeys: CollectionConfig = { + slug: "apikeys", + labels: { + singular: "Clé API", + plural: "Clés API", + }, + fields: [ + { + name: "key", + type: "text", + label: "Clé API", + required: true, + unique: true, + minLength: 32, + maxLength: 32, + }, + ], +}; diff --git a/webapp/src/payload/migrations/20241017_090729.json b/webapp/src/payload/migrations/20241017_090729.json new file mode 100644 index 00000000..7ce2218e --- /dev/null +++ b/webapp/src/payload/migrations/20241017_090729.json @@ -0,0 +1,3730 @@ +{ + "id": "d4d92743-713c-4ea6-998a-38d07fb64eea", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "5", + "dialect": "pg", + "tables": { + "admins": { + "name": "admins", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_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()" + }, + "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 + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "admins_created_at_idx": { + "name": "admins_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "admins_email_idx": { + "name": "admins_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "apikeys": { + "name": "apikeys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "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": { + "apikeys_key_idx": { + "name": "apikeys_key_idx", + "columns": [ + "key" + ], + "isUnique": true + }, + "apikeys_created_at_idx": { + "name": "apikeys_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "civility": { + "name": "civility", + "type": "enum_users_civility", + "primaryKey": false, + "notNull": false + }, + "birth_date": { + "name": "birth_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "user_email": { + "name": "user_email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "cejFrom": { + "name": "cejFrom", + "type": "enum_users_cej_from", + "primaryKey": false, + "notNull": false + }, + "timeAtCEJ": { + "name": "timeAtCEJ", + "type": "enum_users_time_at_c_e_j", + "primaryKey": false, + "notNull": false + }, + "hasAJobIdea": { + "name": "hasAJobIdea", + "type": "enum_users_has_a_job_idea", + "primaryKey": false, + "notNull": false + }, + "project_title": { + "name": "project_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "project_description": { + "name": "project_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "status_image": { + "name": "status_image", + "type": "enum_users_status_image", + "primaryKey": false, + "notNull": false + }, + "notification_status": { + "name": "notification_status", + "type": "enum_users_notification_status", + "primaryKey": false, + "notNull": false + }, + "notification_subscription": { + "name": "notification_subscription", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "otp_request_token": { + "name": "otp_request_token", + "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()" + }, + "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 + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_phone_number_idx": { + "name": "users_phone_number_idx", + "columns": [ + "phone_number" + ], + "isUnique": true + }, + "users_created_at_idx": { + "name": "users_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "users_email_idx": { + "name": "users_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users_rels": { + "name": "users_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 + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_rels_order_idx": { + "name": "users_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "users_rels_parent_idx": { + "name": "users_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "users_rels_path_idx": { + "name": "users_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "users_rels_parent_id_users_id_fk": { + "name": "users_rels_parent_id_users_id_fk", + "tableFrom": "users_rels", + "tableTo": "users", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "users_rels_media_id_media_id_fk": { + "name": "users_rels_media_id_media_id_fk", + "tableFrom": "users_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "users_rels_tags_id_tags_id_fk": { + "name": "users_rels_tags_id_tags_id_fk", + "tableFrom": "users_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "supervisors": { + "name": "supervisors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "cgu": { + "name": "cgu", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "enum_supervisors_kind", + "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()" + }, + "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 + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "supervisors_created_at_idx": { + "name": "supervisors_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "supervisors_email_idx": { + "name": "supervisors_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "supervisorKind": { + "name": "supervisorKind", + "type": "enum_permissions_supervisor_kind", + "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": { + "permissions_phone_number_idx": { + "name": "permissions_phone_number_idx", + "columns": [ + "phone_number" + ], + "isUnique": true + }, + "permissions_created_at_idx": { + "name": "permissions_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "permissions_rels": { + "name": "permissions_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 + }, + "supervisors_id": { + "name": "supervisors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "permissions_rels_order_idx": { + "name": "permissions_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "permissions_rels_parent_idx": { + "name": "permissions_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "permissions_rels_path_idx": { + "name": "permissions_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "permissions_rels_parent_id_permissions_id_fk": { + "name": "permissions_rels_parent_id_permissions_id_fk", + "tableFrom": "permissions_rels", + "tableTo": "permissions", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permissions_rels_supervisors_id_supervisors_id_fk": { + "name": "permissions_rels_supervisors_id_supervisors_id_fk", + "tableFrom": "permissions_rels", + "tableTo": "supervisors", + "columnsFrom": [ + "supervisors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "media": { + "name": "media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "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_created_at_idx": { + "name": "media_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "media_filename_idx": { + "name": "media_filename_idx", + "columns": [ + "filename" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories": { + "name": "categories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "text_white": { + "name": "text_white", + "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": { + "categories_slug_idx": { + "name": "categories_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "categories_created_at_idx": { + "name": "categories_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_rels": { + "name": "categories_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 + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "categories_rels_order_idx": { + "name": "categories_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "categories_rels_parent_idx": { + "name": "categories_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "categories_rels_path_idx": { + "name": "categories_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_rels_parent_id_categories_id_fk": { + "name": "categories_rels_parent_id_categories_id_fk", + "tableFrom": "categories_rels", + "tableTo": "categories", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "categories_rels_media_id_media_id_fk": { + "name": "categories_rels_media_id_media_id_fk", + "tableFrom": "categories_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "partners": { + "name": "partners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "stared": { + "name": "stared", + "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": { + "partners_name_idx": { + "name": "partners_name_idx", + "columns": [ + "name" + ], + "isUnique": true + }, + "partners_created_at_idx": { + "name": "partners_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "partners_rels": { + "name": "partners_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 + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "partners_rels_order_idx": { + "name": "partners_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "partners_rels_parent_idx": { + "name": "partners_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "partners_rels_path_idx": { + "name": "partners_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "partners_rels_parent_id_partners_id_fk": { + "name": "partners_rels_parent_id_partners_id_fk", + "tableFrom": "partners_rels", + "tableTo": "partners", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "partners_rels_media_id_media_id_fk": { + "name": "partners_rels_media_id_media_id_fk", + "tableFrom": "partners_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_terms_of_use": { + "name": "offers_terms_of_use", + "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 + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_highlighted": { + "name": "is_highlighted", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_terms_of_use_order_idx": { + "name": "offers_terms_of_use_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_terms_of_use_parent_id_idx": { + "name": "offers_terms_of_use_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_terms_of_use__parent_id_offers_id_fk": { + "name": "offers_terms_of_use__parent_id_offers_id_fk", + "tableFrom": "offers_terms_of_use", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_conditions": { + "name": "offers_conditions", + "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 + }, + "text": { + "name": "text", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "offers_conditions_order_idx": { + "name": "offers_conditions_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_conditions_parent_id_idx": { + "name": "offers_conditions_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_conditions__parent_id_offers_id_fk": { + "name": "offers_conditions__parent_id_offers_id_fk", + "tableFrom": "offers_conditions", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_condition_blocks": { + "name": "offers_condition_blocks", + "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 + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "offers_condition_blocks_order_idx": { + "name": "offers_condition_blocks_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_condition_blocks_parent_id_idx": { + "name": "offers_condition_blocks_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_condition_blocks__parent_id_offers_id_fk": { + "name": "offers_condition_blocks__parent_id_offers_id_fk", + "tableFrom": "offers_condition_blocks", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers": { + "name": "offers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "formated_title": { + "name": "formated_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "subtitle": { + "name": "subtitle", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "validity_from": { + "name": "validity_from", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "validity_to": { + "name": "validity_to", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "enum_offers_kind", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "nb_of_eligible_stores": { + "name": "nb_of_eligible_stores", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "link_of_eligible_stores": { + "name": "link_of_eligible_stores", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "barcodeFormat": { + "name": "barcodeFormat", + "type": "enum_offers_barcode_format", + "primaryKey": false, + "notNull": false + }, + "nb_seen": { + "name": "nb_seen", + "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": { + "offers_created_at_idx": { + "name": "offers_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_rels": { + "name": "offers_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 + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "categories_id": { + "name": "categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_rels_order_idx": { + "name": "offers_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "offers_rels_parent_idx": { + "name": "offers_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "offers_rels_path_idx": { + "name": "offers_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_rels_parent_id_offers_id_fk": { + "name": "offers_rels_parent_id_offers_id_fk", + "tableFrom": "offers_rels", + "tableTo": "offers", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_partners_id_partners_id_fk": { + "name": "offers_rels_partners_id_partners_id_fk", + "tableFrom": "offers_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_categories_id_categories_id_fk": { + "name": "offers_rels_categories_id_categories_id_fk", + "tableFrom": "offers_rels", + "tableTo": "categories", + "columnsFrom": [ + "categories_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_tags_id_tags_id_fk": { + "name": "offers_rels_tags_id_tags_id_fk", + "tableFrom": "offers_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_media_id_media_id_fk": { + "name": "offers_rels_media_id_media_id_fk", + "tableFrom": "offers_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "coupons": { + "name": "coupons", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "used": { + "name": "used", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "used_at": { + "name": "used_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "assign_user_at": { + "name": "assign_user_at", + "type": "timestamp(3) with time zone", + "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": { + "coupons_created_at_idx": { + "name": "coupons_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "coupons_rels": { + "name": "coupons_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 + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "coupons_rels_order_idx": { + "name": "coupons_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "coupons_rels_parent_idx": { + "name": "coupons_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "coupons_rels_path_idx": { + "name": "coupons_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "coupons_rels_parent_id_coupons_id_fk": { + "name": "coupons_rels_parent_id_coupons_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "coupons", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "coupons_rels_users_id_users_id_fk": { + "name": "coupons_rels_users_id_users_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "coupons_rels_offers_id_offers_id_fk": { + "name": "coupons_rels_offers_id_offers_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "savings": { + "name": "savings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "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": { + "savings_created_at_idx": { + "name": "savings_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "savings_rels": { + "name": "savings_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 + }, + "coupons_id": { + "name": "coupons_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "savings_rels_order_idx": { + "name": "savings_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "savings_rels_parent_idx": { + "name": "savings_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "savings_rels_path_idx": { + "name": "savings_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "savings_rels_parent_id_savings_id_fk": { + "name": "savings_rels_parent_id_savings_id_fk", + "tableFrom": "savings_rels", + "tableTo": "savings", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "savings_rels_coupons_id_coupons_id_fk": { + "name": "savings_rels_coupons_id_coupons_id_fk", + "tableFrom": "savings_rels", + "tableTo": "coupons", + "columnsFrom": [ + "coupons_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "notifications": { + "name": "notifications", + "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 + }, + "message": { + "name": "message", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "app_version": { + "name": "app_version", + "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": { + "notifications_created_at_idx": { + "name": "notifications_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "notifications_rels": { + "name": "notifications_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 + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "notifications_rels_order_idx": { + "name": "notifications_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "notifications_rels_parent_idx": { + "name": "notifications_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "notifications_rels_path_idx": { + "name": "notifications_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "notifications_rels_parent_id_notifications_id_fk": { + "name": "notifications_rels_parent_id_notifications_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "notifications", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notifications_rels_users_id_users_id_fk": { + "name": "notifications_rels_users_id_users_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notifications_rels_offers_id_offers_id_fk": { + "name": "notifications_rels_offers_id_offers_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "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": { + "tags_slug_idx": { + "name": "tags_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "tags_created_at_idx": { + "name": "tags_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_rels": { + "name": "tags_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 + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "tags_rels_order_idx": { + "name": "tags_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "tags_rels_parent_idx": { + "name": "tags_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "tags_rels_path_idx": { + "name": "tags_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_rels_parent_id_tags_id_fk": { + "name": "tags_rels_parent_id_tags_id_fk", + "tableFrom": "tags_rels", + "tableTo": "tags", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_rels_media_id_media_id_fk": { + "name": "tags_rels_media_id_media_id_fk", + "tableFrom": "tags_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "search_requests": { + "name": "search_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "numeric", + "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": { + "search_requests_name_idx": { + "name": "search_requests_name_idx", + "columns": [ + "name" + ], + "isUnique": true + }, + "search_requests_created_at_idx": { + "name": "search_requests_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "email_auth_tokens": { + "name": "email_auth_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "expiration": { + "name": "expiration", + "type": "timestamp(3) with time zone", + "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": { + "email_auth_tokens_created_at_idx": { + "name": "email_auth_tokens_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "email_auth_tokens_rels": { + "name": "email_auth_tokens_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": { + "email_auth_tokens_rels_order_idx": { + "name": "email_auth_tokens_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "email_auth_tokens_rels_parent_idx": { + "name": "email_auth_tokens_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "email_auth_tokens_rels_path_idx": { + "name": "email_auth_tokens_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "email_auth_tokens_rels_parent_id_email_auth_tokens_id_fk": { + "name": "email_auth_tokens_rels_parent_id_email_auth_tokens_id_fk", + "tableFrom": "email_auth_tokens_rels", + "tableTo": "email_auth_tokens", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "email_auth_tokens_rels_users_id_users_id_fk": { + "name": "email_auth_tokens_rels_users_id_users_id_fk", + "tableFrom": "email_auth_tokens_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": [ + "key" + ], + "isUnique": false + }, + "payload_preferences_created_at_idx": { + "name": "payload_preferences_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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 + }, + "admins_id": { + "name": "admins_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "supervisors_id": { + "name": "supervisors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "payload_preferences_rels_order_idx": { + "name": "payload_preferences_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "payload_preferences_rels_parent_idx": { + "name": "payload_preferences_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "payload_preferences_rels_path_idx": { + "name": "payload_preferences_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "payload_preferences_rels_parent_id_payload_preferences_id_fk": { + "name": "payload_preferences_rels_parent_id_payload_preferences_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "payload_preferences", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_admins_id_admins_id_fk": { + "name": "payload_preferences_rels_admins_id_admins_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "admins", + "columnsFrom": [ + "admins_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_users_id_users_id_fk": { + "name": "payload_preferences_rels_users_id_users_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_supervisors_id_supervisors_id_fk": { + "name": "payload_preferences_rels_supervisors_id_supervisors_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "supervisors", + "columnsFrom": [ + "supervisors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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_created_at_idx": { + "name": "payload_migrations_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access_items": { + "name": "quick_access_items", + "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": { + "quick_access_items_order_idx": { + "name": "quick_access_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "quick_access_items_parent_id_idx": { + "name": "quick_access_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "quick_access_items__parent_id_quick_access_id_fk": { + "name": "quick_access_items__parent_id_quick_access_id_fk", + "tableFrom": "quick_access_items", + "tableTo": "quick_access", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access": { + "name": "quick_access", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access_rels": { + "name": "quick_access_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 + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "quick_access_rels_order_idx": { + "name": "quick_access_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "quick_access_rels_parent_idx": { + "name": "quick_access_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "quick_access_rels_path_idx": { + "name": "quick_access_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "quick_access_rels_parent_id_quick_access_id_fk": { + "name": "quick_access_rels_parent_id_quick_access_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "quick_access", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "quick_access_rels_partners_id_partners_id_fk": { + "name": "quick_access_rels_partners_id_partners_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "quick_access_rels_offers_id_offers_id_fk": { + "name": "quick_access_rels_offers_id_offers_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners_items": { + "name": "landing_partners_items", + "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": { + "landing_partners_items_order_idx": { + "name": "landing_partners_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "landing_partners_items_parent_id_idx": { + "name": "landing_partners_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_partners_items__parent_id_landing_partners_id_fk": { + "name": "landing_partners_items__parent_id_landing_partners_id_fk", + "tableFrom": "landing_partners_items", + "tableTo": "landing_partners", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners": { + "name": "landing_partners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners_rels": { + "name": "landing_partners_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 + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "landing_partners_rels_order_idx": { + "name": "landing_partners_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "landing_partners_rels_parent_idx": { + "name": "landing_partners_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "landing_partners_rels_path_idx": { + "name": "landing_partners_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_partners_rels_parent_id_landing_partners_id_fk": { + "name": "landing_partners_rels_parent_id_landing_partners_id_fk", + "tableFrom": "landing_partners_rels", + "tableTo": "landing_partners", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "landing_partners_rels_partners_id_partners_id_fk": { + "name": "landing_partners_rels_partners_id_partners_id_fk", + "tableFrom": "landing_partners_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_f_a_q_items": { + "name": "landing_f_a_q_items", + "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": true + }, + "content": { + "name": "content", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "landing_f_a_q_items_order_idx": { + "name": "landing_f_a_q_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "landing_f_a_q_items_parent_id_idx": { + "name": "landing_f_a_q_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_f_a_q_items__parent_id_landing_f_a_q_id_fk": { + "name": "landing_f_a_q_items__parent_id_landing_f_a_q_id_fk", + "tableFrom": "landing_f_a_q_items", + "tableTo": "landing_f_a_q", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_f_a_q": { + "name": "landing_f_a_q", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category_items": { + "name": "new_category_items", + "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": { + "new_category_items_order_idx": { + "name": "new_category_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "new_category_items_parent_id_idx": { + "name": "new_category_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "new_category_items__parent_id_new_category_id_fk": { + "name": "new_category_items__parent_id_new_category_id_fk", + "tableFrom": "new_category_items", + "tableTo": "new_category", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category": { + "name": "new_category", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category_rels": { + "name": "new_category_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 + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "new_category_rels_order_idx": { + "name": "new_category_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "new_category_rels_parent_idx": { + "name": "new_category_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "new_category_rels_path_idx": { + "name": "new_category_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "new_category_rels_parent_id_new_category_id_fk": { + "name": "new_category_rels_parent_id_new_category_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "new_category", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "new_category_rels_media_id_media_id_fk": { + "name": "new_category_rels_media_id_media_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "new_category_rels_offers_id_offers_id_fk": { + "name": "new_category_rels_offers_id_offers_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list_items": { + "name": "categories_list_items", + "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": { + "categories_list_items_order_idx": { + "name": "categories_list_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "categories_list_items_parent_id_idx": { + "name": "categories_list_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_list_items__parent_id_categories_list_id_fk": { + "name": "categories_list_items__parent_id_categories_list_id_fk", + "tableFrom": "categories_list_items", + "tableTo": "categories_list", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list": { + "name": "categories_list", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list_rels": { + "name": "categories_list_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 + }, + "categories_id": { + "name": "categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "categories_list_rels_order_idx": { + "name": "categories_list_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "categories_list_rels_parent_idx": { + "name": "categories_list_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "categories_list_rels_path_idx": { + "name": "categories_list_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_list_rels_parent_id_categories_list_id_fk": { + "name": "categories_list_rels_parent_id_categories_list_id_fk", + "tableFrom": "categories_list_rels", + "tableTo": "categories_list", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "categories_list_rels_categories_id_categories_id_fk": { + "name": "categories_list_rels_categories_id_categories_id_fk", + "tableFrom": "categories_list_rels", + "tableTo": "categories", + "columnsFrom": [ + "categories_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list_items": { + "name": "tags_list_items", + "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": { + "tags_list_items_order_idx": { + "name": "tags_list_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "tags_list_items_parent_id_idx": { + "name": "tags_list_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_list_items__parent_id_tags_list_id_fk": { + "name": "tags_list_items__parent_id_tags_list_id_fk", + "tableFrom": "tags_list_items", + "tableTo": "tags_list", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list": { + "name": "tags_list", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list_rels": { + "name": "tags_list_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 + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "tags_list_rels_order_idx": { + "name": "tags_list_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "tags_list_rels_parent_idx": { + "name": "tags_list_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "tags_list_rels_path_idx": { + "name": "tags_list_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_list_rels_parent_id_tags_list_id_fk": { + "name": "tags_list_rels_parent_id_tags_list_id_fk", + "tableFrom": "tags_list_rels", + "tableTo": "tags_list", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_list_rels_tags_id_tags_id_fk": { + "name": "tags_list_rels_tags_id_tags_id_fk", + "tableFrom": "tags_list_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "_locales": { + "name": "_locales", + "values": { + "fr": "fr" + } + }, + "enum_users_civility": { + "name": "enum_users_civility", + "values": { + "man": "man", + "woman": "woman" + } + }, + "enum_users_cej_from": { + "name": "enum_users_cej_from", + "values": { + "franceTravail": "franceTravail", + "missionLocale": "missionLocale", + "serviceCivique": "serviceCivique", + "ecole2ndeChance": "ecole2ndeChance", + "epide": "epide" + } + }, + "enum_users_time_at_c_e_j": { + "name": "enum_users_time_at_c_e_j", + "values": { + "started": "started", + "lessThan3Months": "lessThan3Months", + "moreThan3Months": "moreThan3Months" + } + }, + "enum_users_has_a_job_idea": { + "name": "enum_users_has_a_job_idea", + "values": { + "yes": "yes", + "no": "no" + } + }, + "enum_users_status_image": { + "name": "enum_users_status_image", + "values": { + "pending": "pending", + "approved": "approved" + } + }, + "enum_users_notification_status": { + "name": "enum_users_notification_status", + "values": { + "enabled": "enabled", + "disabled": "disabled" + } + }, + "enum_supervisors_kind": { + "name": "enum_supervisors_kind", + "values": { + "ML": "ML", + "SC": "SC", + "FT": "FT" + } + }, + "enum_permissions_supervisor_kind": { + "name": "enum_permissions_supervisor_kind", + "values": { + "ML": "ML", + "SC": "SC", + "FT": "FT" + } + }, + "enum_offers_kind": { + "name": "enum_offers_kind", + "values": { + "voucher": "voucher", + "voucher_pass": "voucher_pass", + "code": "code", + "code_space": "code_space" + } + }, + "enum_offers_barcode_format": { + "name": "enum_offers_barcode_format", + "values": { + "CODE39": "CODE39", + "EAN13": "EAN13", + "ITF14": "ITF14", + "MSI": "MSI", + "pharmacode": "pharmacode", + "codabar": "codabar", + "upc": "upc" + } + } + }, + "schemas": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/webapp/src/payload/migrations/20241017_090729.ts b/webapp/src/payload/migrations/20241017_090729.ts new file mode 100644 index 00000000..822fdc06 --- /dev/null +++ b/webapp/src/payload/migrations/20241017_090729.ts @@ -0,0 +1,24 @@ +import { MigrateUpArgs, MigrateDownArgs } from '@payloadcms/db-postgres' +import { sql } from 'drizzle-orm' + +export async function up({ payload }: MigrateUpArgs): Promise { +await payload.db.drizzle.execute(sql` + +CREATE TABLE IF NOT EXISTS "apikeys" ( + "id" serial PRIMARY KEY NOT NULL, + "key" varchar NOT NULL, + "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL +); + +CREATE UNIQUE INDEX IF NOT EXISTS "apikeys_key_idx" ON "apikeys" ("key"); +CREATE INDEX IF NOT EXISTS "apikeys_created_at_idx" ON "apikeys" ("created_at");`); + +}; + +export async function down({ payload }: MigrateDownArgs): Promise { +await payload.db.drizzle.execute(sql` + +DROP TABLE "apikeys";`); + +}; diff --git a/webapp/src/payload/payload.config.ts b/webapp/src/payload/payload.config.ts index 10ea9210..ac2ae968 100644 --- a/webapp/src/payload/payload.config.ts +++ b/webapp/src/payload/payload.config.ts @@ -14,6 +14,7 @@ import { CategoriesList } from "./globals/CategoriesList"; import { TagsList } from "./globals/TagsList"; import { Admins } from "./collections/Admin"; +import { ApiKeys } from "./collections/ApiKey"; import { Users } from "./collections/User"; import { Media } from "./collections/Media"; import { Categories } from "./collections/Categorie"; @@ -69,6 +70,7 @@ export default buildConfig({ }, collections: [ Admins, + ApiKeys, Users, Supervisors, Permissions,