diff --git a/packages/backend/src/graphql/resolvers/social/notifications.ts b/packages/backend/src/graphql/resolvers/social/notifications.ts index 359ee69f..ed0f6773 100644 --- a/packages/backend/src/graphql/resolvers/social/notifications.ts +++ b/packages/backend/src/graphql/resolvers/social/notifications.ts @@ -154,7 +154,7 @@ export const socialNotificationQueries = { MAX(n."created_at") as "latestCreatedAt", BOOL_AND(n."read_at" IS NOT NULL) as "allRead", (array_agg(c."body" ORDER BY n."created_at" DESC))[1] as "commentBody", - (array_agg(DISTINCT n."actor_id"))[1:3] as "actorIds" + (array_remove(array_agg(DISTINCT n."actor_id"), NULL))[1:3] as "actorIds" FROM "notifications" n LEFT JOIN "comments" c ON n."comment_id" = c."id" WHERE n."recipient_id" = ${userId} @@ -197,12 +197,14 @@ export const socialNotificationQueries = { const actorAvatarUrls = row.actorAvatarUrls || []; const actors = actorIds - .filter((id): id is string => id != null) .map((id, i) => ({ id, displayName: actorDisplayNames[i] || undefined, avatarUrl: actorAvatarUrls[i] || undefined, - })); + })) + .filter((actor): actor is { id: string; displayName: string | undefined; avatarUrl: string | undefined } => + actor.id != null, + ); return { uuid: row.latestUuid, diff --git a/packages/db/drizzle/0056_fix_vote_counts_hot_score_fallback.sql b/packages/db/drizzle/0056_fix_vote_counts_hot_score_fallback.sql new file mode 100644 index 00000000..78c4afbc --- /dev/null +++ b/packages/db/drizzle/0056_fix_vote_counts_hot_score_fallback.sql @@ -0,0 +1,76 @@ +-- Fix update_vote_counts trigger to use MIN(votes.created_at) as fallback +-- instead of NOW() when no feed_items row exists. +-- +-- Previously the trigger used NOW() as the fallback, while the backfill in +-- 0053_add_vote_counts.sql used MIN(v.created_at). This caused inconsistent +-- hot_score calculations: when a previously-backfilled entity received a new +-- vote, the trigger would recalculate using NOW() instead of the original +-- earliest vote time, artificially boosting the entity's hot_score. + +CREATE OR REPLACE FUNCTION update_vote_counts() RETURNS trigger AS $$ +DECLARE + v_entity_type social_entity_type; + v_entity_id text; + v_up int; + v_down int; + v_score int; + v_hot_score double precision; + v_created_at timestamp; +BEGIN + -- Determine which entity was affected + IF TG_OP = 'DELETE' THEN + v_entity_type := OLD.entity_type; + v_entity_id := OLD.entity_id; + ELSE + v_entity_type := NEW.entity_type; + v_entity_id := NEW.entity_id; + END IF; + + -- Recount (safe, idempotent) + SELECT + COALESCE(SUM(CASE WHEN value = 1 THEN 1 ELSE 0 END), 0), + COALESCE(SUM(CASE WHEN value = -1 THEN 1 ELSE 0 END), 0) + INTO v_up, v_down + FROM votes + WHERE entity_type = v_entity_type AND entity_id = v_entity_id; + + v_score := v_up - v_down; + + -- Get entity creation time from feed_items if available, otherwise fall back + -- to the earliest vote time. Using MIN(created_at) from votes is consistent + -- with the backfill logic and provides a stable proxy for entity age. + SELECT COALESCE( + (SELECT fi."created_at" FROM feed_items fi + WHERE fi."entity_type" = v_entity_type::text AND fi."entity_id" = v_entity_id + LIMIT 1), + (SELECT MIN(vt."created_at") FROM votes vt + WHERE vt."entity_type" = v_entity_type AND vt."entity_id" = v_entity_id) + ) INTO v_created_at; + + -- Final fallback to NOW() only if no votes exist (shouldn't happen in + -- practice since this trigger fires on the votes table) + IF v_created_at IS NULL THEN + v_created_at := NOW(); + END IF; + + -- Hot score: sign(score) * ln(max(|score|, 1)) + epoch/45000 + v_hot_score := SIGN(v_score) * LN(GREATEST(ABS(v_score), 1)) + + EXTRACT(EPOCH FROM v_created_at) / 45000.0; + + -- Upsert + INSERT INTO vote_counts (entity_type, entity_id, upvotes, downvotes, score, hot_score, created_at) + VALUES (v_entity_type, v_entity_id, v_up, v_down, v_score, v_hot_score, v_created_at) + ON CONFLICT (entity_type, entity_id) DO UPDATE SET + upvotes = EXCLUDED.upvotes, + downvotes = EXCLUDED.downvotes, + score = EXCLUDED.score, + hot_score = EXCLUDED.hot_score; + + -- Clean up zero-vote rows + IF v_up = 0 AND v_down = 0 THEN + DELETE FROM vote_counts WHERE entity_type = v_entity_type AND entity_id = v_entity_id; + END IF; + + RETURN NULL; +END; +$$ LANGUAGE plpgsql; diff --git a/packages/db/drizzle/meta/0054_snapshot.json b/packages/db/drizzle/meta/0054_snapshot.json index 669b161a..cde19cd4 100644 --- a/packages/db/drizzle/meta/0054_snapshot.json +++ b/packages/db/drizzle/meta/0054_snapshot.json @@ -1,6 +1,6 @@ { - "id": "a882eb14-c395-4053-a8ea-7fb6f2a08fff", - "prevId": "51d546b0-3246-4893-bf56-1edb3d4ceb27", + "id": "51d546b0-3246-4893-bf56-1edb3d4ceb27", + "prevId": "13332eba-f4fb-4538-81a8-7ece0ec51db2", "version": "7", "dialect": "postgresql", "tables": { @@ -2638,385 +2638,6 @@ "checkConstraints": {}, "isRLSEnabled": false }, - "public.gym_follows": { - "name": "gym_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "gym_id": { - "name": "gym_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "gym_follows_unique_gym_user": { - "name": "gym_follows_unique_gym_user", - "columns": [ - { - "expression": "gym_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "gym_follows_gym_id_gyms_id_fk": { - "name": "gym_follows_gym_id_gyms_id_fk", - "tableFrom": "gym_follows", - "tableTo": "gyms", - "columnsFrom": [ - "gym_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "gym_follows_user_id_users_id_fk": { - "name": "gym_follows_user_id_users_id_fk", - "tableFrom": "gym_follows", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.gym_members": { - "name": "gym_members", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "gym_id": { - "name": "gym_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "gym_member_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "gym_members_unique_gym_user": { - "name": "gym_members_unique_gym_user", - "columns": [ - { - "expression": "gym_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "gym_members_gym_id_gyms_id_fk": { - "name": "gym_members_gym_id_gyms_id_fk", - "tableFrom": "gym_members", - "tableTo": "gyms", - "columnsFrom": [ - "gym_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "gym_members_user_id_users_id_fk": { - "name": "gym_members_user_id_users_id_fk", - "tableFrom": "gym_members", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.gyms": { - "name": "gyms", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "uuid": { - "name": "uuid", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_id": { - "name": "owner_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "contact_phone": { - "name": "contact_phone", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "latitude": { - "name": "latitude", - "type": "double precision", - "primaryKey": false, - "notNull": false - }, - "longitude": { - "name": "longitude", - "type": "double precision", - "primaryKey": false, - "notNull": false - }, - "is_public": { - "name": "is_public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "gyms_unique_slug": { - "name": "gyms_unique_slug", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"gyms\".\"deleted_at\" IS NULL", - "concurrently": false, - "method": "btree", - "with": {} - }, - "gyms_uuid_idx": { - "name": "gyms_uuid_idx", - "columns": [ - { - "expression": "uuid", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "gyms_owner_idx": { - "name": "gyms_owner_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"gyms\".\"deleted_at\" IS NULL", - "concurrently": false, - "method": "btree", - "with": {} - }, - "gyms_public_idx": { - "name": "gyms_public_idx", - "columns": [ - { - "expression": "is_public", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"gyms\".\"deleted_at\" IS NULL", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "gyms_owner_id_users_id_fk": { - "name": "gyms_owner_id_users_id_fk", - "tableFrom": "gyms", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "gyms_uuid_unique": { - "name": "gyms_uuid_unique", - "nullsNotDistinct": false, - "columns": [ - "uuid" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, "public.board_follows": { "name": "board_follows", "schema": "", @@ -3244,12 +2865,6 @@ "notNull": true, "default": "now()" }, - "gym_id": { - "name": "gym_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, "deleted_at": { "name": "deleted_at", "type": "timestamp", @@ -3258,21 +2873,6 @@ } }, "indexes": { - "user_boards_gym_idx": { - "name": "user_boards_gym_idx", - "columns": [ - { - "expression": "gym_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, "user_boards_unique_owner_config": { "name": "user_boards_unique_owner_config", "columns": [ @@ -3408,19 +3008,6 @@ ], "onDelete": "cascade", "onUpdate": "no action" - }, - "user_boards_gym_id_gyms_id_fk": { - "name": "user_boards_gym_id_gyms_id_fk", - "tableFrom": "user_boards", - "tableTo": "gyms", - "columnsFrom": [ - "gym_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -6861,14 +6448,6 @@ } }, "enums": { - "public.gym_member_role": { - "name": "gym_member_role", - "schema": "public", - "values": [ - "admin", - "member" - ] - }, "public.aurora_table_type": { "name": "aurora_table_type", "schema": "public", @@ -6906,8 +6485,7 @@ "tick", "comment", "proposal", - "board", - "gym" + "board" ] }, "public.notification_type": { diff --git a/packages/db/drizzle/meta/0056_snapshot.json b/packages/db/drizzle/meta/0056_snapshot.json new file mode 100644 index 00000000..4cdefc2c --- /dev/null +++ b/packages/db/drizzle/meta/0056_snapshot.json @@ -0,0 +1,7135 @@ +{ + "id": "0d5cebcb-1597-4d20-9e73-c330e9be5dfc", + "prevId": "a882eb14-c395-4053-a8ea-7fb6f2a08fff", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.board_attempts": { + "name": "board_attempts", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_attempts_board_type_id_pk": { + "name": "board_attempts_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_beta_links": { + "name": "board_beta_links", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "foreign_username": { + "name": "foreign_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "thumbnail": { + "name": "thumbnail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_beta_links_board_type_climb_uuid_link_pk": { + "name": "board_beta_links_board_type_climb_uuid_link_pk", + "columns": [ + "board_type", + "climb_uuid", + "link" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_circuits": { + "name": "board_circuits", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_circuits_user_fk": { + "name": "board_circuits_user_fk", + "tableFrom": "board_circuits", + "tableTo": "board_users", + "columnsFrom": [ + "board_type", + "user_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_circuits_board_type_uuid_pk": { + "name": "board_circuits_board_type_uuid_pk", + "columns": [ + "board_type", + "uuid" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_circuits_climbs": { + "name": "board_circuits_climbs", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "circuit_uuid": { + "name": "circuit_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_circuits_climbs_circuit_fk": { + "name": "board_circuits_climbs_circuit_fk", + "tableFrom": "board_circuits_climbs", + "tableTo": "board_circuits", + "columnsFrom": [ + "board_type", + "circuit_uuid" + ], + "columnsTo": [ + "board_type", + "uuid" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_circuits_climbs_climb_fk": { + "name": "board_circuits_climbs_climb_fk", + "tableFrom": "board_circuits_climbs", + "tableTo": "board_climbs", + "columnsFrom": [ + "climb_uuid" + ], + "columnsTo": [ + "uuid" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_circuits_climbs_board_type_circuit_uuid_climb_uuid_pk": { + "name": "board_circuits_climbs_board_type_circuit_uuid_climb_uuid_pk", + "columns": [ + "board_type", + "circuit_uuid", + "climb_uuid" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_climb_holds": { + "name": "board_climb_holds", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hold_id": { + "name": "hold_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "frame_number": { + "name": "frame_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "hold_state": { + "name": "hold_state", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "board_climb_holds_search_idx": { + "name": "board_climb_holds_search_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "hold_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "hold_state", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "board_climb_holds_climb_fk": { + "name": "board_climb_holds_climb_fk", + "tableFrom": "board_climb_holds", + "tableTo": "board_climbs", + "columnsFrom": [ + "climb_uuid" + ], + "columnsTo": [ + "uuid" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_climb_holds_board_type_climb_uuid_hold_id_pk": { + "name": "board_climb_holds_board_type_climb_uuid_hold_id_pk", + "columns": [ + "board_type", + "climb_uuid", + "hold_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_climb_stats": { + "name": "board_climb_stats", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "display_difficulty": { + "name": "display_difficulty", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "benchmark_difficulty": { + "name": "benchmark_difficulty", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "ascensionist_count": { + "name": "ascensionist_count", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "difficulty_average": { + "name": "difficulty_average", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "quality_average": { + "name": "quality_average", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "fa_username": { + "name": "fa_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fa_at": { + "name": "fa_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_climb_stats_board_type_climb_uuid_angle_pk": { + "name": "board_climb_stats_board_type_climb_uuid_angle_pk", + "columns": [ + "board_type", + "climb_uuid", + "angle" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_climb_stats_history": { + "name": "board_climb_stats_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "display_difficulty": { + "name": "display_difficulty", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "benchmark_difficulty": { + "name": "benchmark_difficulty", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "ascensionist_count": { + "name": "ascensionist_count", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "difficulty_average": { + "name": "difficulty_average", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "quality_average": { + "name": "quality_average", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "fa_username": { + "name": "fa_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fa_at": { + "name": "fa_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "board_climb_stats_history_lookup_idx": { + "name": "board_climb_stats_history_lookup_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "angle", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_climbs": { + "name": "board_climbs", + "schema": "", + "columns": { + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "setter_id": { + "name": "setter_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "setter_username": { + "name": "setter_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "hsm": { + "name": "hsm", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_left": { + "name": "edge_left", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_right": { + "name": "edge_right", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_bottom": { + "name": "edge_bottom", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_top": { + "name": "edge_top", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "frames_count": { + "name": "frames_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "frames_pace": { + "name": "frames_pace", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "frames": { + "name": "frames", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_draft": { + "name": "is_draft", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced": { + "name": "synced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "sync_error": { + "name": "sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "board_climbs_board_type_idx": { + "name": "board_climbs_board_type_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_climbs_layout_filter_idx": { + "name": "board_climbs_layout_filter_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_listed", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_draft", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "frames_count", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_climbs_edges_idx": { + "name": "board_climbs_edges_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "edge_left", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "edge_right", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "edge_bottom", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "edge_top", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "board_climbs_user_id_users_id_fk": { + "name": "board_climbs_user_id_users_id_fk", + "tableFrom": "board_climbs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_difficulty_grades": { + "name": "board_difficulty_grades", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "difficulty": { + "name": "difficulty", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "boulder_name": { + "name": "boulder_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "route_name": { + "name": "route_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_difficulty_grades_board_type_difficulty_pk": { + "name": "board_difficulty_grades_board_type_difficulty_pk", + "columns": [ + "board_type", + "difficulty" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_holes": { + "name": "board_holes", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mirrored_hole_id": { + "name": "mirrored_hole_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mirror_group": { + "name": "mirror_group", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "board_holes_product_fk": { + "name": "board_holes_product_fk", + "tableFrom": "board_holes", + "tableTo": "board_products", + "columnsFrom": [ + "board_type", + "product_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_holes_board_type_id_pk": { + "name": "board_holes_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_layouts": { + "name": "board_layouts", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instagram_caption": { + "name": "instagram_caption", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_mirrored": { + "name": "is_mirrored", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_layouts_product_fk": { + "name": "board_layouts_product_fk", + "tableFrom": "board_layouts", + "tableTo": "board_products", + "columnsFrom": [ + "board_type", + "product_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_layouts_board_type_id_pk": { + "name": "board_layouts_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_leds": { + "name": "board_leds", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_size_id": { + "name": "product_size_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hole_id": { + "name": "hole_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_leds_product_size_fk": { + "name": "board_leds_product_size_fk", + "tableFrom": "board_leds", + "tableTo": "board_product_sizes", + "columnsFrom": [ + "board_type", + "product_size_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_leds_hole_fk": { + "name": "board_leds_hole_fk", + "tableFrom": "board_leds", + "tableTo": "board_holes", + "columnsFrom": [ + "board_type", + "hole_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_leds_board_type_id_pk": { + "name": "board_leds_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_placement_roles": { + "name": "board_placement_roles", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "led_color": { + "name": "led_color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "screen_color": { + "name": "screen_color", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_placement_roles_product_fk": { + "name": "board_placement_roles_product_fk", + "tableFrom": "board_placement_roles", + "tableTo": "board_products", + "columnsFrom": [ + "board_type", + "product_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_placement_roles_board_type_id_pk": { + "name": "board_placement_roles_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_placements": { + "name": "board_placements", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hole_id": { + "name": "hole_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "set_id": { + "name": "set_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "default_placement_role_id": { + "name": "default_placement_role_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_placements_layout_fk": { + "name": "board_placements_layout_fk", + "tableFrom": "board_placements", + "tableTo": "board_layouts", + "columnsFrom": [ + "board_type", + "layout_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_placements_hole_fk": { + "name": "board_placements_hole_fk", + "tableFrom": "board_placements", + "tableTo": "board_holes", + "columnsFrom": [ + "board_type", + "hole_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_placements_set_fk": { + "name": "board_placements_set_fk", + "tableFrom": "board_placements", + "tableTo": "board_sets", + "columnsFrom": [ + "board_type", + "set_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_placements_role_fk": { + "name": "board_placements_role_fk", + "tableFrom": "board_placements", + "tableTo": "board_placement_roles", + "columnsFrom": [ + "board_type", + "default_placement_role_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_placements_board_type_id_pk": { + "name": "board_placements_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_product_sizes": { + "name": "board_product_sizes", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "edge_left": { + "name": "edge_left", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_right": { + "name": "edge_right", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_bottom": { + "name": "edge_bottom", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "edge_top": { + "name": "edge_top", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image_filename": { + "name": "image_filename", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_product_sizes_product_fk": { + "name": "board_product_sizes_product_fk", + "tableFrom": "board_product_sizes", + "tableTo": "board_products", + "columnsFrom": [ + "board_type", + "product_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_product_sizes_board_type_id_pk": { + "name": "board_product_sizes_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_product_sizes_layouts_sets": { + "name": "board_product_sizes_layouts_sets", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_size_id": { + "name": "product_size_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "set_id": { + "name": "set_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "image_filename": { + "name": "image_filename", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_psls_product_size_fk": { + "name": "board_psls_product_size_fk", + "tableFrom": "board_product_sizes_layouts_sets", + "tableTo": "board_product_sizes", + "columnsFrom": [ + "board_type", + "product_size_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_psls_layout_fk": { + "name": "board_psls_layout_fk", + "tableFrom": "board_product_sizes_layouts_sets", + "tableTo": "board_layouts", + "columnsFrom": [ + "board_type", + "layout_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_psls_set_fk": { + "name": "board_psls_set_fk", + "tableFrom": "board_product_sizes_layouts_sets", + "tableTo": "board_sets", + "columnsFrom": [ + "board_type", + "set_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_product_sizes_layouts_sets_board_type_id_pk": { + "name": "board_product_sizes_layouts_sets_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_products": { + "name": "board_products", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "min_count_in_frame": { + "name": "min_count_in_frame", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "max_count_in_frame": { + "name": "max_count_in_frame", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_products_board_type_id_pk": { + "name": "board_products_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_sets": { + "name": "board_sets", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hsm": { + "name": "hsm", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_sets_board_type_id_pk": { + "name": "board_sets_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_shared_syncs": { + "name": "board_shared_syncs", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_name": { + "name": "table_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_synchronized_at": { + "name": "last_synchronized_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_shared_syncs_board_type_table_name_pk": { + "name": "board_shared_syncs_board_type_table_name_pk", + "columns": [ + "board_type", + "table_name" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_tags": { + "name": "board_tags", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_uuid": { + "name": "entity_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_tags_board_type_entity_uuid_user_id_name_pk": { + "name": "board_tags_board_type_entity_uuid_user_id_name_pk", + "columns": [ + "board_type", + "entity_uuid", + "user_id", + "name" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_user_syncs": { + "name": "board_user_syncs", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "table_name": { + "name": "table_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_synchronized_at": { + "name": "last_synchronized_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_user_syncs_user_fk": { + "name": "board_user_syncs_user_fk", + "tableFrom": "board_user_syncs", + "tableTo": "board_users", + "columnsFrom": [ + "board_type", + "user_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_user_syncs_board_type_user_id_table_name_pk": { + "name": "board_user_syncs_board_type_user_id_table_name_pk", + "columns": [ + "board_type", + "user_id", + "table_name" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_users": { + "name": "board_users", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "board_users_board_type_id_pk": { + "name": "board_users_board_type_id_pk", + "columns": [ + "board_type", + "id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_walls": { + "name": "board_walls", + "schema": "", + "columns": { + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_adjustable": { + "name": "is_adjustable", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "product_size_id": { + "name": "product_size_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hsm": { + "name": "hsm", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "serial_number": { + "name": "serial_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_walls_user_fk": { + "name": "board_walls_user_fk", + "tableFrom": "board_walls", + "tableTo": "board_users", + "columnsFrom": [ + "board_type", + "user_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "board_walls_product_fk": { + "name": "board_walls_product_fk", + "tableFrom": "board_walls", + "tableTo": "board_products", + "columnsFrom": [ + "board_type", + "product_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + }, + "board_walls_layout_fk": { + "name": "board_walls_layout_fk", + "tableFrom": "board_walls", + "tableTo": "board_layouts", + "columnsFrom": [ + "board_type", + "layout_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + }, + "board_walls_product_size_fk": { + "name": "board_walls_product_size_fk", + "tableFrom": "board_walls", + "tableTo": "board_product_sizes", + "columnsFrom": [ + "board_type", + "product_size_id" + ], + "columnsTo": [ + "board_type", + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "board_walls_board_type_uuid_pk": { + "name": "board_walls_board_type_uuid_pk", + "columns": [ + "board_type", + "uuid" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.accounts": { + "name": "accounts", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "accounts_userId_users_id_fk": { + "name": "accounts_userId_users_id_fk", + "tableFrom": "accounts", + "tableTo": "users", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "accounts_provider_providerAccountId_pk": { + "name": "accounts_provider_providerAccountId_pk", + "columns": [ + "provider", + "providerAccountId" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_userId_users_id_fk": { + "name": "sessions_userId_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verificationTokens": { + "name": "verificationTokens", + "schema": "", + "columns": { + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "verificationTokens_identifier_token_pk": { + "name": "verificationTokens_identifier_token_pk", + "columns": [ + "identifier", + "token" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_credentials": { + "name": "user_credentials", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_credentials_user_id_users_id_fk": { + "name": "user_credentials_user_id_users_id_fk", + "tableFrom": "user_credentials", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_profiles": { + "name": "user_profiles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instagram_url": { + "name": "instagram_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_profiles_user_id_users_id_fk": { + "name": "user_profiles_user_id_users_id_fk", + "tableFrom": "user_profiles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.aurora_credentials": { + "name": "aurora_credentials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_username": { + "name": "encrypted_username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_password": { + "name": "encrypted_password", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "aurora_user_id": { + "name": "aurora_user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "aurora_token": { + "name": "aurora_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_status": { + "name": "sync_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "sync_error": { + "name": "sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_user_board_credential": { + "name": "unique_user_board_credential", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "aurora_credentials_user_idx": { + "name": "aurora_credentials_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "aurora_credentials_user_id_users_id_fk": { + "name": "aurora_credentials_user_id_users_id_fk", + "tableFrom": "aurora_credentials", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_board_mappings": { + "name": "user_board_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_user_id": { + "name": "board_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "board_username": { + "name": "board_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "linked_at": { + "name": "linked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_user_board_mapping": { + "name": "unique_user_board_mapping", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_user_mapping_idx": { + "name": "board_user_mapping_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_board_mappings_user_id_users_id_fk": { + "name": "user_board_mappings_user_id_users_id_fk", + "tableFrom": "user_board_mappings", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gym_follows": { + "name": "gym_follows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "gym_id": { + "name": "gym_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "gym_follows_unique_gym_user": { + "name": "gym_follows_unique_gym_user", + "columns": [ + { + "expression": "gym_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gym_follows_gym_id_gyms_id_fk": { + "name": "gym_follows_gym_id_gyms_id_fk", + "tableFrom": "gym_follows", + "tableTo": "gyms", + "columnsFrom": [ + "gym_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "gym_follows_user_id_users_id_fk": { + "name": "gym_follows_user_id_users_id_fk", + "tableFrom": "gym_follows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gym_members": { + "name": "gym_members", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "gym_id": { + "name": "gym_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "gym_member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "gym_members_unique_gym_user": { + "name": "gym_members_unique_gym_user", + "columns": [ + { + "expression": "gym_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gym_members_gym_id_gyms_id_fk": { + "name": "gym_members_gym_id_gyms_id_fk", + "tableFrom": "gym_members", + "tableTo": "gyms", + "columnsFrom": [ + "gym_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "gym_members_user_id_users_id_fk": { + "name": "gym_members_user_id_users_id_fk", + "tableFrom": "gym_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gyms": { + "name": "gyms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "latitude": { + "name": "latitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "longitude": { + "name": "longitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "gyms_unique_slug": { + "name": "gyms_unique_slug", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"gyms\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "gyms_uuid_idx": { + "name": "gyms_uuid_idx", + "columns": [ + { + "expression": "uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "gyms_owner_idx": { + "name": "gyms_owner_idx", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"gyms\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "gyms_public_idx": { + "name": "gyms_public_idx", + "columns": [ + { + "expression": "is_public", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"gyms\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gyms_owner_id_users_id_fk": { + "name": "gyms_owner_id_users_id_fk", + "tableFrom": "gyms", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "gyms_uuid_unique": { + "name": "gyms_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_follows": { + "name": "board_follows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_uuid": { + "name": "board_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "board_follows_unique_user_board": { + "name": "board_follows_unique_user_board", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_follows_user_idx": { + "name": "board_follows_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_follows_board_uuid_idx": { + "name": "board_follows_board_uuid_idx", + "columns": [ + { + "expression": "board_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "board_follows_user_id_users_id_fk": { + "name": "board_follows_user_id_users_id_fk", + "tableFrom": "board_follows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "board_follows_board_uuid_user_boards_uuid_fk": { + "name": "board_follows_board_uuid_user_boards_uuid_fk", + "tableFrom": "board_follows", + "tableTo": "user_boards", + "columnsFrom": [ + "board_uuid" + ], + "columnsTo": [ + "uuid" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_boards": { + "name": "user_boards", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "size_id": { + "name": "size_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "set_ids": { + "name": "set_ids", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location_name": { + "name": "location_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "latitude": { + "name": "latitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "longitude": { + "name": "longitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "is_owned": { + "name": "is_owned", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "gym_id": { + "name": "gym_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_boards_gym_idx": { + "name": "user_boards_gym_idx", + "columns": [ + { + "expression": "gym_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_boards_unique_owner_config": { + "name": "user_boards_unique_owner_config", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "size_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "set_ids", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"user_boards\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_boards_owner_owned_idx": { + "name": "user_boards_owner_owned_idx", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_owned", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"user_boards\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_boards_public_idx": { + "name": "user_boards_public_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_public", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"user_boards\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_boards_unique_slug": { + "name": "user_boards_unique_slug", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"user_boards\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_boards_uuid_idx": { + "name": "user_boards_uuid_idx", + "columns": [ + { + "expression": "uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_boards_owner_id_users_id_fk": { + "name": "user_boards_owner_id_users_id_fk", + "tableFrom": "user_boards", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_boards_gym_id_gyms_id_fk": { + "name": "user_boards_gym_id_gyms_id_fk", + "tableFrom": "user_boards", + "tableTo": "gyms", + "columnsFrom": [ + "gym_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_boards_uuid_unique": { + "name": "user_boards_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_session_clients": { + "name": "board_session_clients", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "connected_at": { + "name": "connected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_leader": { + "name": "is_leader", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "board_session_clients_session_id_board_sessions_id_fk": { + "name": "board_session_clients_session_id_board_sessions_id_fk", + "tableFrom": "board_session_clients", + "tableTo": "board_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_session_queues": { + "name": "board_session_queues", + "schema": "", + "columns": { + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "queue": { + "name": "queue", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "current_climb_queue_item": { + "name": "current_climb_queue_item", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'null'::jsonb" + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "board_session_queues_session_id_board_sessions_id_fk": { + "name": "board_session_queues_session_id_board_sessions_id_fk", + "tableFrom": "board_session_queues", + "tableTo": "board_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.board_sessions": { + "name": "board_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "board_path": { + "name": "board_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_activity": { + "name": "last_activity", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "latitude": { + "name": "latitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "longitude": { + "name": "longitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "discoverable": { + "name": "discoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "board_id": { + "name": "board_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "goal": { + "name": "goal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_permanent": { + "name": "is_permanent", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "board_sessions_location_idx": { + "name": "board_sessions_location_idx", + "columns": [ + { + "expression": "latitude", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "longitude", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_sessions_discoverable_idx": { + "name": "board_sessions_discoverable_idx", + "columns": [ + { + "expression": "discoverable", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_sessions_user_idx": { + "name": "board_sessions_user_idx", + "columns": [ + { + "expression": "created_by_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_sessions_status_idx": { + "name": "board_sessions_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_sessions_last_activity_idx": { + "name": "board_sessions_last_activity_idx", + "columns": [ + { + "expression": "last_activity", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "board_sessions_discovery_idx": { + "name": "board_sessions_discovery_idx", + "columns": [ + { + "expression": "discoverable", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_activity", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "board_sessions_created_by_user_id_users_id_fk": { + "name": "board_sessions_created_by_user_id_users_id_fk", + "tableFrom": "board_sessions", + "tableTo": "users", + "columnsFrom": [ + "created_by_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "board_sessions_board_id_user_boards_id_fk": { + "name": "board_sessions_board_id_user_boards_id_fk", + "tableFrom": "board_sessions", + "tableTo": "user_boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session_boards": { + "name": "session_boards", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_id": { + "name": "board_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "session_boards_session_board_idx": { + "name": "session_boards_session_board_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "session_boards_session_idx": { + "name": "session_boards_session_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "session_boards_board_idx": { + "name": "session_boards_board_idx", + "columns": [ + { + "expression": "board_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_boards_session_id_board_sessions_id_fk": { + "name": "session_boards_session_id_board_sessions_id_fk", + "tableFrom": "session_boards", + "tableTo": "board_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "session_boards_board_id_user_boards_id_fk": { + "name": "session_boards_board_id_user_boards_id_fk", + "tableFrom": "session_boards", + "tableTo": "user_boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_favorites": { + "name": "user_favorites", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_name": { + "name": "board_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_user_favorite": { + "name": "unique_user_favorite", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "angle", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_favorites_user_idx": { + "name": "user_favorites_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_favorites_climb_idx": { + "name": "user_favorites_climb_idx", + "columns": [ + { + "expression": "board_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "angle", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_favorites_user_id_users_id_fk": { + "name": "user_favorites_user_id_users_id_fk", + "tableFrom": "user_favorites", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.boardsesh_ticks": { + "name": "boardsesh_ticks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "is_mirror": { + "name": "is_mirror", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "status": { + "name": "status", + "type": "tick_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "attempt_count": { + "name": "attempt_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "quality": { + "name": "quality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "difficulty": { + "name": "difficulty", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_benchmark": { + "name": "is_benchmark", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "climbed_at": { + "name": "climbed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "board_id": { + "name": "board_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "aurora_type": { + "name": "aurora_type", + "type": "aurora_table_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "aurora_id": { + "name": "aurora_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "aurora_synced_at": { + "name": "aurora_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "aurora_sync_error": { + "name": "aurora_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "boardsesh_ticks_user_board_idx": { + "name": "boardsesh_ticks_user_board_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_climb_idx": { + "name": "boardsesh_ticks_climb_idx", + "columns": [ + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_aurora_id_unique": { + "name": "boardsesh_ticks_aurora_id_unique", + "columns": [ + { + "expression": "aurora_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_sync_pending_idx": { + "name": "boardsesh_ticks_sync_pending_idx", + "columns": [ + { + "expression": "aurora_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_session_idx": { + "name": "boardsesh_ticks_session_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_climbed_at_idx": { + "name": "boardsesh_ticks_climbed_at_idx", + "columns": [ + { + "expression": "climbed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_board_climbed_at_idx": { + "name": "boardsesh_ticks_board_climbed_at_idx", + "columns": [ + { + "expression": "board_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "climbed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "boardsesh_ticks_board_user_idx": { + "name": "boardsesh_ticks_board_user_idx", + "columns": [ + { + "expression": "board_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "boardsesh_ticks_user_id_users_id_fk": { + "name": "boardsesh_ticks_user_id_users_id_fk", + "tableFrom": "boardsesh_ticks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "boardsesh_ticks_session_id_board_sessions_id_fk": { + "name": "boardsesh_ticks_session_id_board_sessions_id_fk", + "tableFrom": "boardsesh_ticks", + "tableTo": "board_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "boardsesh_ticks_board_id_user_boards_id_fk": { + "name": "boardsesh_ticks_board_id_user_boards_id_fk", + "tableFrom": "boardsesh_ticks", + "tableTo": "user_boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "boardsesh_ticks_uuid_unique": { + "name": "boardsesh_ticks_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playlist_climbs": { + "name": "playlist_climbs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "playlist_id": { + "name": "playlist_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "added_at": { + "name": "added_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_playlist_climb": { + "name": "unique_playlist_climb", + "columns": [ + { + "expression": "playlist_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlist_climbs_climb_idx": { + "name": "playlist_climbs_climb_idx", + "columns": [ + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlist_climbs_position_idx": { + "name": "playlist_climbs_position_idx", + "columns": [ + { + "expression": "playlist_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "position", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "playlist_climbs_playlist_id_playlists_id_fk": { + "name": "playlist_climbs_playlist_id_playlists_id_fk", + "tableFrom": "playlist_climbs", + "tableTo": "playlists", + "columnsFrom": [ + "playlist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playlist_ownership": { + "name": "playlist_ownership", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "playlist_id": { + "name": "playlist_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'owner'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_playlist_ownership": { + "name": "unique_playlist_ownership", + "columns": [ + { + "expression": "playlist_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlist_ownership_user_idx": { + "name": "playlist_ownership_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "playlist_ownership_playlist_id_playlists_id_fk": { + "name": "playlist_ownership_playlist_id_playlists_id_fk", + "tableFrom": "playlist_ownership", + "tableTo": "playlists", + "columnsFrom": [ + "playlist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "playlist_ownership_user_id_users_id_fk": { + "name": "playlist_ownership_user_id_users_id_fk", + "tableFrom": "playlist_ownership", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playlists": { + "name": "playlists", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "aurora_type": { + "name": "aurora_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "aurora_id": { + "name": "aurora_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "aurora_synced_at": { + "name": "aurora_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_accessed_at": { + "name": "last_accessed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "playlists_board_layout_idx": { + "name": "playlists_board_layout_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlists_uuid_idx": { + "name": "playlists_uuid_idx", + "columns": [ + { + "expression": "uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlists_updated_at_idx": { + "name": "playlists_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlists_last_accessed_at_idx": { + "name": "playlists_last_accessed_at_idx", + "columns": [ + { + "expression": "last_accessed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "playlists_aurora_id_idx": { + "name": "playlists_aurora_id_idx", + "columns": [ + { + "expression": "aurora_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "playlists_uuid_unique": { + "name": "playlists_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_hold_classifications": { + "name": "user_hold_classifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "size_id": { + "name": "size_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "hold_id": { + "name": "hold_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "hold_type": { + "name": "hold_type", + "type": "hold_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "hand_rating": { + "name": "hand_rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "foot_rating": { + "name": "foot_rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pull_direction": { + "name": "pull_direction", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "user_hold_classifications_user_board_idx": { + "name": "user_hold_classifications_user_board_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "size_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_hold_classifications_unique_idx": { + "name": "user_hold_classifications_unique_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "size_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "hold_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_hold_classifications_hold_idx": { + "name": "user_hold_classifications_hold_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "hold_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_hold_classifications_user_id_users_id_fk": { + "name": "user_hold_classifications_user_id_users_id_fk", + "tableFrom": "user_hold_classifications", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.esp32_controllers": { + "name": "esp32_controllers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_key": { + "name": "api_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "board_name": { + "name": "board_name", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "size_id": { + "name": "size_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "set_ids": { + "name": "set_ids", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "authorized_session_id": { + "name": "authorized_session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "esp32_controllers_user_idx": { + "name": "esp32_controllers_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "esp32_controllers_api_key_idx": { + "name": "esp32_controllers_api_key_idx", + "columns": [ + { + "expression": "api_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "esp32_controllers_session_idx": { + "name": "esp32_controllers_session_idx", + "columns": [ + { + "expression": "authorized_session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "esp32_controllers_user_id_users_id_fk": { + "name": "esp32_controllers_user_id_users_id_fk", + "tableFrom": "esp32_controllers", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "esp32_controllers_api_key_unique": { + "name": "esp32_controllers_api_key_unique", + "nullsNotDistinct": false, + "columns": [ + "api_key" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_follows": { + "name": "user_follows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "follower_id": { + "name": "follower_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "following_id": { + "name": "following_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_user_follow": { + "name": "unique_user_follow", + "columns": [ + { + "expression": "follower_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "following_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_follows_follower_idx": { + "name": "user_follows_follower_idx", + "columns": [ + { + "expression": "follower_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_follows_following_idx": { + "name": "user_follows_following_idx", + "columns": [ + { + "expression": "following_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_follows_follower_id_users_id_fk": { + "name": "user_follows_follower_id_users_id_fk", + "tableFrom": "user_follows", + "tableTo": "users", + "columnsFrom": [ + "follower_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_follows_following_id_users_id_fk": { + "name": "user_follows_following_id_users_id_fk", + "tableFrom": "user_follows", + "tableTo": "users", + "columnsFrom": [ + "following_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "no_self_follow": { + "name": "no_self_follow", + "value": "\"user_follows\".\"follower_id\" != \"user_follows\".\"following_id\"" + } + }, + "isRLSEnabled": false + }, + "public.comments": { + "name": "comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "social_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "comments_entity_created_at_idx": { + "name": "comments_entity_created_at_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "comments_user_created_at_idx": { + "name": "comments_user_created_at_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "comments_parent_comment_idx": { + "name": "comments_parent_comment_idx", + "columns": [ + { + "expression": "parent_comment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "comments_user_id_users_id_fk": { + "name": "comments_user_id_users_id_fk", + "tableFrom": "comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "comments_uuid_unique": { + "name": "comments_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.votes": { + "name": "votes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "social_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "votes_unique_user_entity": { + "name": "votes_unique_user_entity", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "votes_entity_idx": { + "name": "votes_entity_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "votes_user_idx": { + "name": "votes_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "votes_user_id_users_id_fk": { + "name": "votes_user_id_users_id_fk", + "tableFrom": "votes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "vote_value_check": { + "name": "vote_value_check", + "value": "\"votes\".\"value\" IN (1, -1)" + } + }, + "isRLSEnabled": false + }, + "public.notifications": { + "name": "notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "recipient_id": { + "name": "recipient_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "notification_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "social_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "comment_id": { + "name": "comment_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "read_at": { + "name": "read_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_recipient_unread_idx": { + "name": "notifications_recipient_unread_idx", + "columns": [ + { + "expression": "recipient_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "read_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "notifications_recipient_created_at_idx": { + "name": "notifications_recipient_created_at_idx", + "columns": [ + { + "expression": "recipient_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "notifications_dedup_idx": { + "name": "notifications_dedup_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "recipient_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "notifications_created_at_idx": { + "name": "notifications_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notifications_recipient_id_users_id_fk": { + "name": "notifications_recipient_id_users_id_fk", + "tableFrom": "notifications", + "tableTo": "users", + "columnsFrom": [ + "recipient_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notifications_actor_id_users_id_fk": { + "name": "notifications_actor_id_users_id_fk", + "tableFrom": "notifications", + "tableTo": "users", + "columnsFrom": [ + "actor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notifications_comment_id_comments_id_fk": { + "name": "notifications_comment_id_comments_id_fk", + "tableFrom": "notifications", + "tableTo": "comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "notifications_uuid_unique": { + "name": "notifications_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.feed_items": { + "name": "feed_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "recipient_id": { + "name": "recipient_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "feed_item_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "social_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_uuid": { + "name": "board_uuid", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "feed_items_recipient_created_at_idx": { + "name": "feed_items_recipient_created_at_idx", + "columns": [ + { + "expression": "recipient_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"created_at\" desc", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "\"id\" desc", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "feed_items_recipient_board_created_at_idx": { + "name": "feed_items_recipient_board_created_at_idx", + "columns": [ + { + "expression": "recipient_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"created_at\" desc", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "\"id\" desc", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "feed_items_actor_created_at_idx": { + "name": "feed_items_actor_created_at_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "feed_items_created_at_idx": { + "name": "feed_items_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "feed_items_recipient_id_users_id_fk": { + "name": "feed_items_recipient_id_users_id_fk", + "tableFrom": "feed_items", + "tableTo": "users", + "columnsFrom": [ + "recipient_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "feed_items_actor_id_users_id_fk": { + "name": "feed_items_actor_id_users_id_fk", + "tableFrom": "feed_items", + "tableTo": "users", + "columnsFrom": [ + "actor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.climb_classic_status": { + "name": "climb_classic_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_classic": { + "name": "is_classic", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_proposal_id": { + "name": "last_proposal_id", + "type": "bigserial", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "climb_classic_status_unique_idx": { + "name": "climb_classic_status_unique_idx", + "columns": [ + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "climb_classic_status_last_proposal_id_climb_proposals_id_fk": { + "name": "climb_classic_status_last_proposal_id_climb_proposals_id_fk", + "tableFrom": "climb_classic_status", + "tableTo": "climb_proposals", + "columnsFrom": [ + "last_proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.climb_community_status": { + "name": "climb_community_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "community_grade": { + "name": "community_grade", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_benchmark": { + "name": "is_benchmark", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_proposal_id": { + "name": "last_proposal_id", + "type": "bigserial", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "climb_community_status_unique_idx": { + "name": "climb_community_status_unique_idx", + "columns": [ + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "angle", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "climb_community_status_last_proposal_id_climb_proposals_id_fk": { + "name": "climb_community_status_last_proposal_id_climb_proposals_id_fk", + "tableFrom": "climb_community_status", + "tableTo": "climb_proposals", + "columnsFrom": [ + "last_proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.climb_proposals": { + "name": "climb_proposals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "climb_uuid": { + "name": "climb_uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "angle": { + "name": "angle", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "proposer_id": { + "name": "proposer_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "proposal_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "proposed_value": { + "name": "proposed_value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "current_value": { + "name": "current_value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "proposal_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resolved_at": { + "name": "resolved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "resolved_by": { + "name": "resolved_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "climb_proposals_climb_angle_type_idx": { + "name": "climb_proposals_climb_angle_type_idx", + "columns": [ + { + "expression": "climb_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "angle", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "climb_proposals_status_idx": { + "name": "climb_proposals_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "climb_proposals_proposer_idx": { + "name": "climb_proposals_proposer_idx", + "columns": [ + { + "expression": "proposer_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "climb_proposals_board_type_idx": { + "name": "climb_proposals_board_type_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "climb_proposals_created_at_idx": { + "name": "climb_proposals_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "climb_proposals_proposer_id_users_id_fk": { + "name": "climb_proposals_proposer_id_users_id_fk", + "tableFrom": "climb_proposals", + "tableTo": "users", + "columnsFrom": [ + "proposer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "climb_proposals_resolved_by_users_id_fk": { + "name": "climb_proposals_resolved_by_users_id_fk", + "tableFrom": "climb_proposals", + "tableTo": "users", + "columnsFrom": [ + "resolved_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "climb_proposals_uuid_unique": { + "name": "climb_proposals_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.community_roles": { + "name": "community_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "community_role_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "granted_by": { + "name": "granted_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "community_roles_board_type_idx": { + "name": "community_roles_board_type_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "community_roles_user_id_users_id_fk": { + "name": "community_roles_user_id_users_id_fk", + "tableFrom": "community_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "community_roles_granted_by_users_id_fk": { + "name": "community_roles_granted_by_users_id_fk", + "tableFrom": "community_roles", + "tableTo": "users", + "columnsFrom": [ + "granted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "community_roles_user_role_board_idx": { + "name": "community_roles_user_role_board_idx", + "nullsNotDistinct": true, + "columns": [ + "user_id", + "role", + "board_type" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.community_settings": { + "name": "community_settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_key": { + "name": "scope_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "set_by": { + "name": "set_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "community_settings_scope_key_idx": { + "name": "community_settings_scope_key_idx", + "columns": [ + { + "expression": "scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "community_settings_set_by_users_id_fk": { + "name": "community_settings_set_by_users_id_fk", + "tableFrom": "community_settings", + "tableTo": "users", + "columnsFrom": [ + "set_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.proposal_votes": { + "name": "proposal_votes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "proposal_id": { + "name": "proposal_id", + "type": "bigserial", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "weight": { + "name": "weight", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "proposal_votes_unique_user_proposal": { + "name": "proposal_votes_unique_user_proposal", + "columns": [ + { + "expression": "proposal_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "proposal_votes_proposal_idx": { + "name": "proposal_votes_proposal_idx", + "columns": [ + { + "expression": "proposal_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "proposal_votes_proposal_id_climb_proposals_id_fk": { + "name": "proposal_votes_proposal_id_climb_proposals_id_fk", + "tableFrom": "proposal_votes", + "tableTo": "climb_proposals", + "columnsFrom": [ + "proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "proposal_votes_user_id_users_id_fk": { + "name": "proposal_votes_user_id_users_id_fk", + "tableFrom": "proposal_votes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "proposal_vote_value_check": { + "name": "proposal_vote_value_check", + "value": "\"proposal_votes\".\"value\" IN (1, -1)" + } + }, + "isRLSEnabled": false + }, + "public.new_climb_subscriptions": { + "name": "new_climb_subscriptions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "board_type": { + "name": "board_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "layout_id": { + "name": "layout_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "new_climb_subscriptions_unique_user_board_layout": { + "name": "new_climb_subscriptions_unique_user_board_layout", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "new_climb_subscriptions_user_idx": { + "name": "new_climb_subscriptions_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "new_climb_subscriptions_board_layout_idx": { + "name": "new_climb_subscriptions_board_layout_idx", + "columns": [ + { + "expression": "board_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "layout_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "new_climb_subscriptions_user_id_users_id_fk": { + "name": "new_climb_subscriptions_user_id_users_id_fk", + "tableFrom": "new_climb_subscriptions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vote_counts": { + "name": "vote_counts", + "schema": "", + "columns": { + "entity_type": { + "name": "entity_type", + "type": "social_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "upvotes": { + "name": "upvotes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "downvotes": { + "name": "downvotes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "hot_score": { + "name": "hot_score", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "vote_counts_score_idx": { + "name": "vote_counts_score_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "score", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "vote_counts_hot_score_idx": { + "name": "vote_counts_hot_score_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "hot_score", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "vote_counts_entity_type_entity_id_pk": { + "name": "vote_counts_entity_type_entity_id_pk", + "columns": [ + "entity_type", + "entity_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.gym_member_role": { + "name": "gym_member_role", + "schema": "public", + "values": [ + "admin", + "member" + ] + }, + "public.aurora_table_type": { + "name": "aurora_table_type", + "schema": "public", + "values": [ + "ascents", + "bids" + ] + }, + "public.tick_status": { + "name": "tick_status", + "schema": "public", + "values": [ + "flash", + "send", + "attempt" + ] + }, + "public.hold_type": { + "name": "hold_type", + "schema": "public", + "values": [ + "jug", + "sloper", + "pinch", + "crimp", + "pocket" + ] + }, + "public.social_entity_type": { + "name": "social_entity_type", + "schema": "public", + "values": [ + "playlist_climb", + "climb", + "tick", + "comment", + "proposal", + "board", + "gym" + ] + }, + "public.notification_type": { + "name": "notification_type", + "schema": "public", + "values": [ + "new_follower", + "comment_reply", + "comment_on_tick", + "comment_on_climb", + "vote_on_tick", + "vote_on_comment", + "new_climb", + "new_climb_global", + "proposal_approved", + "proposal_rejected", + "proposal_vote", + "proposal_created" + ] + }, + "public.feed_item_type": { + "name": "feed_item_type", + "schema": "public", + "values": [ + "ascent", + "new_climb", + "comment", + "proposal_approved", + "session_summary" + ] + }, + "public.community_role_type": { + "name": "community_role_type", + "schema": "public", + "values": [ + "admin", + "community_leader" + ] + }, + "public.proposal_status": { + "name": "proposal_status", + "schema": "public", + "values": [ + "open", + "approved", + "rejected", + "superseded" + ] + }, + "public.proposal_type": { + "name": "proposal_type", + "schema": "public", + "values": [ + "grade", + "classic", + "benchmark" + ] + } + }, + "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 c19980aa..c0c23860 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -393,6 +393,13 @@ "when": 1770985556751, "tag": "0055_enhanced-sessions", "breakpoints": true + }, + { + "idx": 56, + "version": "7", + "when": 1771060417917, + "tag": "0056_fix_vote_counts_hot_score_fallback", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/web/app/hooks/use-paginated-feed.ts b/packages/web/app/hooks/use-paginated-feed.ts index e9168da9..1a6cb7fd 100644 --- a/packages/web/app/hooks/use-paginated-feed.ts +++ b/packages/web/app/hooks/use-paginated-feed.ts @@ -77,7 +77,7 @@ export function usePaginatedFeed({ }, [fetchPage, items.length]); // Inline IntersectionObserver — same pattern as climbs-list.tsx - const sentinelRef = useRef(null); + const sentinelRef = useRef(null); const loadMoreRef = useRef(loadMore); const hasMoreRef = useRef(hasMore); const loadingMoreRef = useRef(loadingMore);