From 228ed12625f10f662559928b01b9074b3328d34f Mon Sep 17 00:00:00 2001 From: Evan Petzoldt Date: Sun, 29 Mar 2026 06:19:07 -0500 Subject: [PATCH 1/3] adding new db indexes for event instances and slack users --- packages/db/drizzle/0011_nervous_sleeper.sql | 4 + packages/db/drizzle/meta/0011_snapshot.json | 3600 ++++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + packages/db/drizzle/schema.ts | 16 + 4 files changed, 3627 insertions(+) create mode 100644 packages/db/drizzle/0011_nervous_sleeper.sql create mode 100644 packages/db/drizzle/meta/0011_snapshot.json diff --git a/packages/db/drizzle/0011_nervous_sleeper.sql b/packages/db/drizzle/0011_nervous_sleeper.sql new file mode 100644 index 00000000..3e9c3474 --- /dev/null +++ b/packages/db/drizzle/0011_nervous_sleeper.sql @@ -0,0 +1,4 @@ +CREATE INDEX "idx_attendance_x_types_type_id" ON "attendance_x_attendance_types" USING btree ("attendance_type_id" int4_ops);--> statement-breakpoint +CREATE INDEX "idx_event_instances_start_date" ON "event_instances" USING btree ("start_date" date_ops);--> statement-breakpoint +CREATE INDEX "idx_event_instances_start_date_active" ON "event_instances" USING btree ((start_date ASC NULLS LAST) WHERE (is_active));--> statement-breakpoint +CREATE INDEX "idx_slack_users_user_team_id" ON "slack_users" USING btree ((user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)); \ No newline at end of file diff --git a/packages/db/drizzle/meta/0011_snapshot.json b/packages/db/drizzle/meta/0011_snapshot.json new file mode 100644 index 00000000..f42bcf80 --- /dev/null +++ b/packages/db/drizzle/meta/0011_snapshot.json @@ -0,0 +1,3600 @@ +{ + "id": "5747dd85-11e2-4478-98a2-17ce67297d8a", + "prevId": "c64f4d41-4497-4b87-8c0d-e9f999fd4e48", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.achievements": { + "name": "achievements", + "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 + }, + "image_url": { + "name": "image_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "specific_org_id": { + "name": "specific_org_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auto_award": { + "name": "auto_award", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "auto_cadence": { + "name": "auto_cadence", + "type": "achievement_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "auto_threshold_type": { + "name": "auto_threshold_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "auto_threshold": { + "name": "auto_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "auto_filters": { + "name": "auto_filters", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "achievements_specific_org_id_fkey": { + "name": "achievements_specific_org_id_fkey", + "tableFrom": "achievements", + "tableTo": "orgs", + "columnsFrom": [ + "specific_org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.achievements_x_users": { + "name": "achievements_x_users", + "schema": "", + "columns": { + "achievement_id": { + "name": "achievement_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "award_year": { + "name": "award_year", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": -1 + }, + "award_period": { + "name": "award_period", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": -1 + }, + "date_awarded": { + "name": "date_awarded", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": { + "achievements_x_users_achievement_id_fkey": { + "name": "achievements_x_users_achievement_id_fkey", + "tableFrom": "achievements_x_users", + "tableTo": "achievements", + "columnsFrom": [ + "achievement_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "achievements_x_users_user_id_fkey": { + "name": "achievements_x_users_user_id_fkey", + "tableFrom": "achievements_x_users", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "achievements_x_users_pkey": { + "name": "achievements_x_users_pkey", + "columns": [ + "achievement_id", + "user_id", + "award_year", + "award_period" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.alembic_version": { + "name": "alembic_version", + "schema": "", + "columns": { + "version_num": { + "name": "version_num", + "type": "varchar(32)", + "primaryKey": true, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": { + "api_keys_owner_id_fkey": { + "name": "api_keys_owner_id_fkey", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_keys_key_key": { + "name": "api_keys_key_key", + "nullsNotDistinct": false, + "columns": [ + "key" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.attendance": { + "name": "attendance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "is_planned": { + "name": "is_planned", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "event_instance_id": { + "name": "event_instance_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_attendance_event_instance_id": { + "name": "idx_attendance_event_instance_id", + "columns": [ + { + "expression": "event_instance_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "event_instance_id_fkey": { + "name": "event_instance_id_fkey", + "tableFrom": "attendance", + "tableTo": "event_instances", + "columnsFrom": [ + "event_instance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "attendance_user_id_fkey": { + "name": "attendance_user_id_fkey", + "tableFrom": "attendance", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "attendance_event_instance_id_user_id_is_planned_key": { + "name": "attendance_event_instance_id_user_id_is_planned_key", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "is_planned", + "event_instance_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.attendance_types": { + "name": "attendance_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.attendance_x_attendance_types": { + "name": "attendance_x_attendance_types", + "schema": "", + "columns": { + "attendance_id": { + "name": "attendance_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attendance_type_id": { + "name": "attendance_type_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_attendance_x_types_type_id": { + "name": "idx_attendance_x_types_type_id", + "columns": [ + { + "expression": "attendance_type_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "attendance_x_attendance_types_attendance_id_fkey": { + "name": "attendance_x_attendance_types_attendance_id_fkey", + "tableFrom": "attendance_x_attendance_types", + "tableTo": "attendance", + "columnsFrom": [ + "attendance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "attendance_x_attendance_types_attendance_type_id_fkey": { + "name": "attendance_x_attendance_types_attendance_type_id_fkey", + "tableFrom": "attendance_x_attendance_types", + "tableTo": "attendance_types", + "columnsFrom": [ + "attendance_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "attendance_x_attendance_types_pkey": { + "name": "attendance_x_attendance_types_pkey", + "columns": [ + "attendance_id", + "attendance_type_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_accounts": { + "name": "auth_accounts", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "provider_account_id": { + "name": "provider_account_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": { + "auth_accounts_user_id_fkey": { + "name": "auth_accounts_user_id_fkey", + "tableFrom": "auth_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "auth_accounts_pkey": { + "name": "auth_accounts_pkey", + "columns": [ + "provider", + "provider_account_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_sessions": { + "name": "auth_sessions", + "schema": "", + "columns": { + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": { + "auth_sessions_user_id_fkey": { + "name": "auth_sessions_user_id_fkey", + "tableFrom": "auth_sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_verification_tokens": { + "name": "auth_verification_tokens", + "schema": "", + "columns": { + "identifier": { + "name": "identifier", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "auth_verification_tokens_pkey": { + "name": "auth_verification_tokens_pkey", + "columns": [ + "identifier", + "token" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_instances": { + "name": "event_instances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "location_id": { + "name": "location_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series_id": { + "name": "series_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "highlight": { + "name": "highlight", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "start_time": { + "name": "start_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "end_time": { + "name": "end_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "pax_count": { + "name": "pax_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "fng_count": { + "name": "fng_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "preblast": { + "name": "preblast", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "backblast": { + "name": "backblast", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "preblast_rich": { + "name": "preblast_rich", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "backblast_rich": { + "name": "backblast_rich", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "preblast_ts": { + "name": "preblast_ts", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "backblast_ts": { + "name": "backblast_ts", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "is_private": { + "name": "is_private", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "series_exception": { + "name": "series_exception", + "type": "series_exception", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": { + "idx_event_instances_is_active": { + "name": "idx_event_instances_is_active", + "columns": [ + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "bool_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_event_instances_location_id": { + "name": "idx_event_instances_location_id", + "columns": [ + { + "expression": "location_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_event_instances_org_id": { + "name": "idx_event_instances_org_id", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_event_instances_start_date": { + "name": "idx_event_instances_start_date", + "columns": [ + { + "expression": "start_date", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "date_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_event_instances_start_date_active": { + "name": "idx_event_instances_start_date_active", + "columns": [ + { + "expression": "(start_date ASC NULLS LAST) WHERE (is_active)", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "event_instances_location_id_fkey": { + "name": "event_instances_location_id_fkey", + "tableFrom": "event_instances", + "tableTo": "locations", + "columnsFrom": [ + "location_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "event_instances_org_id_fkey": { + "name": "event_instances_org_id_fkey", + "tableFrom": "event_instances", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "event_instances_series_id_fkey": { + "name": "event_instances_series_id_fkey", + "tableFrom": "event_instances", + "tableTo": "events", + "columnsFrom": [ + "series_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_instances_x_event_types": { + "name": "event_instances_x_event_types", + "schema": "", + "columns": { + "event_instance_id": { + "name": "event_instance_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "event_type_id": { + "name": "event_type_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "event_instances_x_event_types_event_instance_id_fkey": { + "name": "event_instances_x_event_types_event_instance_id_fkey", + "tableFrom": "event_instances_x_event_types", + "tableTo": "event_instances", + "columnsFrom": [ + "event_instance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "event_instances_x_event_types_event_type_id_fkey": { + "name": "event_instances_x_event_types_event_type_id_fkey", + "tableFrom": "event_instances_x_event_types", + "tableTo": "event_types", + "columnsFrom": [ + "event_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "event_instances_x_event_types_pkey": { + "name": "event_instances_x_event_types_pkey", + "columns": [ + "event_instance_id", + "event_type_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_tags": { + "name": "event_tags", + "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 + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "specific_org_id": { + "name": "specific_org_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "event_tags_specific_org_id_fkey": { + "name": "event_tags_specific_org_id_fkey", + "tableFrom": "event_tags", + "tableTo": "orgs", + "columnsFrom": [ + "specific_org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_tags_x_event_instances": { + "name": "event_tags_x_event_instances", + "schema": "", + "columns": { + "event_instance_id": { + "name": "event_instance_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "event_tag_id": { + "name": "event_tag_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "event_tags_x_event_instances_event_instance_id_fkey": { + "name": "event_tags_x_event_instances_event_instance_id_fkey", + "tableFrom": "event_tags_x_event_instances", + "tableTo": "event_instances", + "columnsFrom": [ + "event_instance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "event_tags_x_event_instances_event_tag_id_fkey": { + "name": "event_tags_x_event_instances_event_tag_id_fkey", + "tableFrom": "event_tags_x_event_instances", + "tableTo": "event_tags", + "columnsFrom": [ + "event_tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "event_tags_x_event_instances_pkey": { + "name": "event_tags_x_event_instances_pkey", + "columns": [ + "event_instance_id", + "event_tag_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_tags_x_events": { + "name": "event_tags_x_events", + "schema": "", + "columns": { + "event_id": { + "name": "event_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "event_tag_id": { + "name": "event_tag_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "event_tags_x_events_event_id_fkey": { + "name": "event_tags_x_events_event_id_fkey", + "tableFrom": "event_tags_x_events", + "tableTo": "events", + "columnsFrom": [ + "event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "event_tags_x_events_event_tag_id_fkey": { + "name": "event_tags_x_events_event_tag_id_fkey", + "tableFrom": "event_tags_x_events", + "tableTo": "event_tags", + "columnsFrom": [ + "event_tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "event_tags_x_events_pkey": { + "name": "event_tags_x_events_pkey", + "columns": [ + "event_id", + "event_tag_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_types": { + "name": "event_types", + "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 + }, + "acronym": { + "name": "acronym", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "specific_org_id": { + "name": "specific_org_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event_category": { + "name": "event_category", + "type": "event_category", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "event_types_specific_org_id_fkey": { + "name": "event_types_specific_org_id_fkey", + "tableFrom": "event_types", + "tableTo": "orgs", + "columnsFrom": [ + "specific_org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "location_id": { + "name": "location_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series_id": { + "name": "series_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "highlight": { + "name": "highlight", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "start_time": { + "name": "start_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "end_time": { + "name": "end_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "day_of_week": { + "name": "day_of_week", + "type": "day_of_week", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "recurrence_pattern": { + "name": "recurrence_pattern", + "type": "event_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "recurrence_interval": { + "name": "recurrence_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "index_within_interval": { + "name": "index_within_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "is_private": { + "name": "is_private", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_events_is_active": { + "name": "idx_events_is_active", + "columns": [ + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "bool_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_events_location_id": { + "name": "idx_events_location_id", + "columns": [ + { + "expression": "location_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_events_org_id": { + "name": "idx_events_org_id", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_location_id_fkey": { + "name": "events_location_id_fkey", + "tableFrom": "events", + "tableTo": "locations", + "columnsFrom": [ + "location_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_org_id_fkey": { + "name": "events_org_id_fkey", + "tableFrom": "events", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_series_id_fkey": { + "name": "events_series_id_fkey", + "tableFrom": "events", + "tableTo": "events", + "columnsFrom": [ + "series_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events_x_event_types": { + "name": "events_x_event_types", + "schema": "", + "columns": { + "event_id": { + "name": "event_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "event_type_id": { + "name": "event_type_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_events_x_event_types_event_id": { + "name": "idx_events_x_event_types_event_id", + "columns": [ + { + "expression": "event_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_events_x_event_types_event_type_id": { + "name": "idx_events_x_event_types_event_type_id", + "columns": [ + { + "expression": "event_type_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_x_event_types_event_id_fkey": { + "name": "events_x_event_types_event_id_fkey", + "tableFrom": "events_x_event_types", + "tableTo": "events", + "columnsFrom": [ + "event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "events_x_event_types_event_type_id_fkey": { + "name": "events_x_event_types_event_type_id_fkey", + "tableFrom": "events_x_event_types", + "tableTo": "event_types", + "columnsFrom": [ + "event_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "events_x_event_types_pkey": { + "name": "events_x_event_types_pkey", + "columns": [ + "event_id", + "event_type_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.expansions": { + "name": "expansions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "area": { + "name": "area", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "pinned_lat": { + "name": "pinned_lat", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "pinned_lon": { + "name": "pinned_lon", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "user_lat": { + "name": "user_lat", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "user_lon": { + "name": "user_lon", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "interested_in_organizing": { + "name": "interested_in_organizing", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.expansions_x_users": { + "name": "expansions_x_users", + "schema": "", + "columns": { + "expansion_id": { + "name": "expansion_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "request_date": { + "name": "request_date", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "notes": { + "name": "notes", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "expansions_x_users_expansion_id_fkey": { + "name": "expansions_x_users_expansion_id_fkey", + "tableFrom": "expansions_x_users", + "tableTo": "expansions", + "columnsFrom": [ + "expansion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "expansions_x_users_user_id_fkey": { + "name": "expansions_x_users_user_id_fkey", + "tableFrom": "expansions_x_users", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "expansions_x_users_pkey": { + "name": "expansions_x_users_pkey", + "columns": [ + "expansion_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.locations": { + "name": "locations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "latitude": { + "name": "latitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "longitude": { + "name": "longitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "address_street": { + "name": "address_street", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address_city": { + "name": "address_city", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address_state": { + "name": "address_state", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address_zip": { + "name": "address_zip", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address_country": { + "name": "address_country", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address_street2": { + "name": "address_street2", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_locations_is_active": { + "name": "idx_locations_is_active", + "columns": [ + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "bool_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_locations_name": { + "name": "idx_locations_name", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_locations_org_id": { + "name": "idx_locations_org_id", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "locations_org_id_fkey": { + "name": "locations_org_id_fkey", + "tableFrom": "locations", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.orgs": { + "name": "orgs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "default_location_id": { + "name": "default_location_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "twitter": { + "name": "twitter", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "facebook": { + "name": "facebook", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "instagram": { + "name": "instagram", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "last_annual_review": { + "name": "last_annual_review", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "ao_count": { + "name": "ao_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "org_type": { + "name": "org_type", + "type": "org_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_orgs_is_active": { + "name": "idx_orgs_is_active", + "columns": [ + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "bool_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_orgs_org_type": { + "name": "idx_orgs_org_type", + "columns": [ + { + "expression": "org_type", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "enum_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_orgs_parent_id": { + "name": "idx_orgs_parent_id", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "int4_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "orgs_parent_id_fkey": { + "name": "orgs_parent_id_fkey", + "tableFrom": "orgs", + "tableTo": "orgs", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.orgs_x_slack_spaces": { + "name": "orgs_x_slack_spaces", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "slack_space_id": { + "name": "slack_space_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "orgs_x_slack_spaces_org_id_fkey": { + "name": "orgs_x_slack_spaces_org_id_fkey", + "tableFrom": "orgs_x_slack_spaces", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "orgs_x_slack_spaces_slack_space_id_fkey": { + "name": "orgs_x_slack_spaces_slack_space_id_fkey", + "tableFrom": "orgs_x_slack_spaces", + "tableTo": "slack_spaces", + "columnsFrom": [ + "slack_space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "orgs_x_slack_spaces_pkey": { + "name": "orgs_x_slack_spaces_pkey", + "columns": [ + "org_id", + "slack_space_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "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 + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.positions": { + "name": "positions", + "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 + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "org_type": { + "name": "org_type", + "type": "org_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "positions_org_id_fkey": { + "name": "positions_org_id_fkey", + "tableFrom": "positions", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.positions_x_orgs_x_users": { + "name": "positions_x_orgs_x_users", + "schema": "", + "columns": { + "position_id": { + "name": "position_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "positions_x_orgs_x_users_org_id_fkey": { + "name": "positions_x_orgs_x_users_org_id_fkey", + "tableFrom": "positions_x_orgs_x_users", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "positions_x_orgs_x_users_position_id_fkey": { + "name": "positions_x_orgs_x_users_position_id_fkey", + "tableFrom": "positions_x_orgs_x_users", + "tableTo": "positions", + "columnsFrom": [ + "position_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "positions_x_orgs_x_users_user_id_fkey": { + "name": "positions_x_orgs_x_users_user_id_fkey", + "tableFrom": "positions_x_orgs_x_users", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "positions_x_orgs_x_users_pkey": { + "name": "positions_x_orgs_x_users_pkey", + "columns": [ + "position_id", + "org_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "region_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles_x_api_keys_x_org": { + "name": "roles_x_api_keys_x_org", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "api_key_id": { + "name": "api_key_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "roles_x_api_keys_x_org_role_id_fkey": { + "name": "roles_x_api_keys_x_org_role_id_fkey", + "tableFrom": "roles_x_api_keys_x_org", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "roles_x_api_keys_x_org_api_key_id_fkey": { + "name": "roles_x_api_keys_x_org_api_key_id_fkey", + "tableFrom": "roles_x_api_keys_x_org", + "tableTo": "api_keys", + "columnsFrom": [ + "api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "roles_x_api_keys_x_org_org_id_fkey": { + "name": "roles_x_api_keys_x_org_org_id_fkey", + "tableFrom": "roles_x_api_keys_x_org", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "roles_x_api_keys_x_org_pkey": { + "name": "roles_x_api_keys_x_org_pkey", + "columns": [ + "role_id", + "api_key_id", + "org_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles_x_permissions": { + "name": "roles_x_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "roles_x_permissions_permission_id_fkey": { + "name": "roles_x_permissions_permission_id_fkey", + "tableFrom": "roles_x_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "roles_x_permissions_role_id_fkey": { + "name": "roles_x_permissions_role_id_fkey", + "tableFrom": "roles_x_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "roles_x_permissions_pkey": { + "name": "roles_x_permissions_pkey", + "columns": [ + "role_id", + "permission_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles_x_users_x_org": { + "name": "roles_x_users_x_org", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "roles_x_users_x_org_org_id_fkey": { + "name": "roles_x_users_x_org_org_id_fkey", + "tableFrom": "roles_x_users_x_org", + "tableTo": "orgs", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "roles_x_users_x_org_role_id_fkey": { + "name": "roles_x_users_x_org_role_id_fkey", + "tableFrom": "roles_x_users_x_org", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "roles_x_users_x_org_user_id_fkey": { + "name": "roles_x_users_x_org_user_id_fkey", + "tableFrom": "roles_x_users_x_org", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "roles_x_users_x_org_pkey": { + "name": "roles_x_users_x_org_pkey", + "columns": [ + "role_id", + "user_id", + "org_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.slack_spaces": { + "name": "slack_spaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "team_id": { + "name": "team_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "workspace_name": { + "name": "workspace_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "bot_token": { + "name": "bot_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "slack_spaces_team_id_key": { + "name": "slack_spaces_team_id_key", + "nullsNotDistinct": false, + "columns": [ + "team_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.slack_users": { + "name": "slack_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slack_id": { + "name": "slack_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "user_name": { + "name": "user_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_owner": { + "name": "is_owner", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_bot": { + "name": "is_bot", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "slack_team_id": { + "name": "slack_team_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "strava_access_token": { + "name": "strava_access_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "strava_refresh_token": { + "name": "strava_refresh_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "strava_expires_at": { + "name": "strava_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "strava_athlete_id": { + "name": "strava_athlete_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "slack_updated": { + "name": "slack_updated", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + } + }, + "indexes": { + "idx_slack_users_user_team_id": { + "name": "idx_slack_users_user_team_id", + "columns": [ + { + "expression": "(user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "slack_users_user_id_fkey": { + "name": "slack_users_user_id_fkey", + "tableFrom": "slack_users", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.update_requests": { + "name": "update_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "region_id": { + "name": "region_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event_type_ids": { + "name": "event_type_ids", + "type": "integer[]", + "primaryKey": false, + "notNull": false + }, + "event_tag": { + "name": "event_tag", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "event_series_id": { + "name": "event_series_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event_is_series": { + "name": "event_is_series", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "event_is_active": { + "name": "event_is_active", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "event_highlight": { + "name": "event_highlight", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "event_start_date": { + "name": "event_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "event_end_date": { + "name": "event_end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "event_start_time": { + "name": "event_start_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "event_end_time": { + "name": "event_end_time", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "event_day_of_week": { + "name": "event_day_of_week", + "type": "day_of_week", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "event_name": { + "name": "event_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "event_description": { + "name": "event_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "event_recurrence_pattern": { + "name": "event_recurrence_pattern", + "type": "event_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "event_recurrence_interval": { + "name": "event_recurrence_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event_index_within_interval": { + "name": "event_index_within_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event_meta": { + "name": "event_meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "event_contact_email": { + "name": "event_contact_email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_name": { + "name": "location_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_description": { + "name": "location_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_address": { + "name": "location_address", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_address2": { + "name": "location_address2", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_city": { + "name": "location_city", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_state": { + "name": "location_state", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_zip": { + "name": "location_zip", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_country": { + "name": "location_country", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "location_lat": { + "name": "location_lat", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "location_lng": { + "name": "location_lng", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "location_id": { + "name": "location_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "location_contact_email": { + "name": "location_contact_email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "ao_id": { + "name": "ao_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ao_name": { + "name": "ao_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "ao_logo": { + "name": "ao_logo", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "ao_website": { + "name": "ao_website", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "submitted_by": { + "name": "submitted_by", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "submitter_validated": { + "name": "submitter_validated", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "reviewed_by": { + "name": "reviewed_by", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reviewed_at": { + "name": "reviewed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "update_request_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "request_type": { + "name": "request_type", + "type": "request_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "update_requests_event_id_fkey": { + "name": "update_requests_event_id_fkey", + "tableFrom": "update_requests", + "tableTo": "events", + "columnsFrom": [ + "event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "update_requests_location_id_fkey": { + "name": "update_requests_location_id_fkey", + "tableFrom": "update_requests", + "tableTo": "locations", + "columnsFrom": [ + "location_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "update_requests_region_id_fkey": { + "name": "update_requests_region_id_fkey", + "tableFrom": "update_requests", + "tableTo": "orgs", + "columnsFrom": [ + "region_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "f3_name": { + "name": "f3_name", + "type": "varchar", + "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 + }, + "email": { + "name": "email", + "type": "citext", + "primaryKey": false, + "notNull": true + }, + "phone": { + "name": "phone", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "home_region_id": { + "name": "home_region_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "meta": { + "name": "meta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "updated": { + "name": "updated", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "timezone('utc'::text, now())" + }, + "emergency_contact": { + "name": "emergency_contact", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "emergency_phone": { + "name": "emergency_phone", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "emergency_notes": { + "name": "emergency_notes", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "user_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_home_region_id_fkey": { + "name": "users_home_region_id_fkey", + "tableFrom": "users", + "tableTo": "orgs", + "columnsFrom": [ + "home_region_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_key": { + "name": "users_email_key", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.achievement_cadence": { + "name": "achievement_cadence", + "schema": "public", + "values": [ + "weekly", + "monthly", + "quarterly", + "yearly", + "lifetime" + ] + }, + "public.day_of_week": { + "name": "day_of_week", + "schema": "public", + "values": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + "sunday" + ] + }, + "public.event_cadence": { + "name": "event_cadence", + "schema": "public", + "values": [ + "weekly", + "monthly" + ] + }, + "public.event_category": { + "name": "event_category", + "schema": "public", + "values": [ + "first_f", + "second_f", + "third_f" + ] + }, + "public.org_type": { + "name": "org_type", + "schema": "public", + "values": [ + "ao", + "region", + "area", + "sector", + "nation" + ] + }, + "public.region_role": { + "name": "region_role", + "schema": "public", + "values": [ + "user", + "editor", + "admin" + ] + }, + "public.request_type": { + "name": "request_type", + "schema": "public", + "values": [ + "create_location", + "create_event", + "edit", + "delete_event" + ] + }, + "public.series_exception": { + "name": "series_exception", + "schema": "public", + "values": [ + "closed", + "different-time", + "miscellaneous" + ] + }, + "public.update_request_status": { + "name": "update_request_status", + "schema": "public", + "values": [ + "pending", + "approved", + "rejected" + ] + }, + "public.user_role": { + "name": "user_role", + "schema": "public", + "values": [ + "user", + "editor", + "admin" + ] + }, + "public.user_status": { + "name": "user_status", + "schema": "public", + "values": [ + "active", + "inactive" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 3e8eaaf3..1d93a1e2 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -78,6 +78,13 @@ "when": 1772193724674, "tag": "0010_silly_giant_man", "breakpoints": true + }, + { + "idx": 11, + "version": "7", + "when": 1774783073729, + "tag": "0011_nervous_sleeper", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/drizzle/schema.ts b/packages/db/drizzle/schema.ts index b381c85a..952b5d18 100644 --- a/packages/db/drizzle/schema.ts +++ b/packages/db/drizzle/schema.ts @@ -125,6 +125,14 @@ export const eventInstances = pgTable( "btree", table.orgId.asc().nullsLast().op("int4_ops"), ), + index("idx_event_instances_start_date").using( + "btree", + table.startDate.asc().nullsLast().op("date_ops"), + ), + index("idx_event_instances_start_date_active").using( + "btree", + sql`(start_date ASC NULLS LAST) WHERE (is_active)`, + ), foreignKey({ columns: [table.locationId], foreignColumns: [locations.id], @@ -216,6 +224,10 @@ export const slackUsers = pgTable( .notNull(), }, (table) => [ + index("idx_slack_users_user_team_id").using( + "btree", + sql`(user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)`, + ), foreignKey({ columns: [table.userId], foreignColumns: [users.id], @@ -789,6 +801,10 @@ export const attendanceXAttendanceTypes = pgTable( attendanceTypeId: integer("attendance_type_id").notNull(), }, (table) => [ + index("idx_attendance_x_types_type_id").using( + "btree", + table.attendanceTypeId.asc().nullsLast().op("int4_ops"), + ), foreignKey({ columns: [table.attendanceId], foreignColumns: [attendance.id], From f2493dfd92f6b48ed2ab8b1681a67e1fdec8f4de Mon Sep 17 00:00:00 2001 From: Evan Petzoldt Date: Sun, 29 Mar 2026 06:27:09 -0500 Subject: [PATCH 2/3] addressing postgres syntax issues --- packages/db/drizzle/0011_nervous_sleeper.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/db/drizzle/0011_nervous_sleeper.sql b/packages/db/drizzle/0011_nervous_sleeper.sql index 3e9c3474..adbe6d7d 100644 --- a/packages/db/drizzle/0011_nervous_sleeper.sql +++ b/packages/db/drizzle/0011_nervous_sleeper.sql @@ -1,4 +1,4 @@ CREATE INDEX "idx_attendance_x_types_type_id" ON "attendance_x_attendance_types" USING btree ("attendance_type_id" int4_ops);--> statement-breakpoint CREATE INDEX "idx_event_instances_start_date" ON "event_instances" USING btree ("start_date" date_ops);--> statement-breakpoint -CREATE INDEX "idx_event_instances_start_date_active" ON "event_instances" USING btree ((start_date ASC NULLS LAST) WHERE (is_active));--> statement-breakpoint -CREATE INDEX "idx_slack_users_user_team_id" ON "slack_users" USING btree ((user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)); \ No newline at end of file +CREATE INDEX "idx_event_instances_start_date_active" ON "event_instances" USING btree ((start_date) WHERE (is_active));--> statement-breakpoint +CREATE INDEX "idx_slack_users_user_team_id" ON "slack_users" USING btree ((user_id), (slack_team_id));--> statement-breakpoint \ No newline at end of file From d7ee9af72446eb807fc4ba2e372c79c96d8cf68e Mon Sep 17 00:00:00 2001 From: Evan Petzoldt Date: Sun, 29 Mar 2026 06:37:04 -0500 Subject: [PATCH 3/3] had to fix schema.ts to get it to generate to sql correctly --- packages/db/drizzle/0011_nervous_sleeper.sql | 4 ++-- packages/db/drizzle/meta/0011_snapshot.json | 18 +++++++++++++----- packages/db/drizzle/schema.ts | 10 +++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/db/drizzle/0011_nervous_sleeper.sql b/packages/db/drizzle/0011_nervous_sleeper.sql index adbe6d7d..eab0dad4 100644 --- a/packages/db/drizzle/0011_nervous_sleeper.sql +++ b/packages/db/drizzle/0011_nervous_sleeper.sql @@ -1,4 +1,4 @@ CREATE INDEX "idx_attendance_x_types_type_id" ON "attendance_x_attendance_types" USING btree ("attendance_type_id" int4_ops);--> statement-breakpoint CREATE INDEX "idx_event_instances_start_date" ON "event_instances" USING btree ("start_date" date_ops);--> statement-breakpoint -CREATE INDEX "idx_event_instances_start_date_active" ON "event_instances" USING btree ((start_date) WHERE (is_active));--> statement-breakpoint -CREATE INDEX "idx_slack_users_user_team_id" ON "slack_users" USING btree ((user_id), (slack_team_id));--> statement-breakpoint \ No newline at end of file +CREATE INDEX "idx_event_instances_start_date_active" ON "event_instances" USING btree ("start_date" date_ops) WHERE is_active;--> statement-breakpoint +CREATE INDEX "idx_slack_users_user_team_id" ON "slack_users" USING btree (user_id, slack_team_id);--> statement-breakpoint \ No newline at end of file diff --git a/packages/db/drizzle/meta/0011_snapshot.json b/packages/db/drizzle/meta/0011_snapshot.json index f42bcf80..78a9c8d1 100644 --- a/packages/db/drizzle/meta/0011_snapshot.json +++ b/packages/db/drizzle/meta/0011_snapshot.json @@ -1013,13 +1013,15 @@ "name": "idx_event_instances_start_date_active", "columns": [ { - "expression": "(start_date ASC NULLS LAST) WHERE (is_active)", + "expression": "start_date", + "isExpression": false, "asc": true, - "isExpression": true, - "nulls": "last" + "nulls": "last", + "opclass": "date_ops" } ], "isUnique": false, + "where": "is_active", "concurrently": false, "method": "btree", "with": {} @@ -2966,9 +2968,15 @@ "name": "idx_slack_users_user_team_id", "columns": [ { - "expression": "(user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)", + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "slack_team_id", + "isExpression": false, "asc": true, - "isExpression": true, "nulls": "last" } ], diff --git a/packages/db/drizzle/schema.ts b/packages/db/drizzle/schema.ts index 952b5d18..cfee4f4a 100644 --- a/packages/db/drizzle/schema.ts +++ b/packages/db/drizzle/schema.ts @@ -129,10 +129,9 @@ export const eventInstances = pgTable( "btree", table.startDate.asc().nullsLast().op("date_ops"), ), - index("idx_event_instances_start_date_active").using( - "btree", - sql`(start_date ASC NULLS LAST) WHERE (is_active)`, - ), + index("idx_event_instances_start_date_active") + .using("btree", table.startDate.asc().nullsLast().op("date_ops")) + .where(sql`is_active`), foreignKey({ columns: [table.locationId], foreignColumns: [locations.id], @@ -226,7 +225,8 @@ export const slackUsers = pgTable( (table) => [ index("idx_slack_users_user_team_id").using( "btree", - sql`(user_id ASC NULLS LAST), (slack_team_id ASC NULLS LAST)`, + table.userId.asc().nullsLast(), + table.slackTeamId.asc().nullsLast(), ), foreignKey({ columns: [table.userId],