{
  "id": "c31d1d9d-2fc7-4085-93d7-b1d550224d70",
  "prevId": "c022bcc0-f90b-4de3-9e6e-84cc3685bbe2",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.user_module_access": {
      "name": "user_module_access",
      "schema": "",
      "columns": {
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "module": {
          "name": "module",
          "type": "varchar(32)",
          "primaryKey": false,
          "notNull": true
        },
        "level": {
          "name": "level",
          "type": "module_access_level",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'NONE'"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "user_module_access_user_id_idx": {
          "name": "user_module_access_user_id_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "user_module_access_user_id_users_id_fk": {
          "name": "user_module_access_user_id_users_id_fk",
          "tableFrom": "user_module_access",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "user_module_access_user_id_module_pk": {
          "name": "user_module_access_user_id_module_pk",
          "columns": [
            "user_id",
            "module"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sessions": {
      "name": "sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "token_hash": {
          "name": "token_hash",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "last_seen_at": {
          "name": "last_seen_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "ip_address": {
          "name": "ip_address",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "sessions_token_hash_unique": {
          "name": "sessions_token_hash_unique",
          "columns": [
            {
              "expression": "token_hash",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "sessions_user_id_idx": {
          "name": "sessions_user_id_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "sessions_expires_at_idx": {
          "name": "sessions_expires_at_idx",
          "columns": [
            {
              "expression": "expires_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "sessions_user_id_users_id_fk": {
          "name": "sessions_user_id_users_id_fk",
          "tableFrom": "sessions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "varchar(320)",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": false
        },
        "role": {
          "name": "role",
          "type": "user_role",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'USER'"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "users_email_unique": {
          "name": "users_email_unique",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_channels": {
      "name": "community_channels",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(64)",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true
        },
        "icon": {
          "name": "icon",
          "type": "varchar(16)",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "visibility": {
          "name": "visibility",
          "type": "channel_visibility",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'MEMBERS'"
        },
        "position": {
          "name": "position",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "community_channels_position_idx": {
          "name": "community_channels_position_idx",
          "columns": [
            {
              "expression": "position",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_chat_messages": {
      "name": "community_chat_messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "legacy_id": {
          "name": "legacy_id",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "chat_id": {
          "name": "chat_id",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true
        },
        "author_id": {
          "name": "author_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "author_name": {
          "name": "author_name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "community_chat_messages_legacy_id_unique": {
          "name": "community_chat_messages_legacy_id_unique",
          "columns": [
            {
              "expression": "legacy_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "community_chat_messages_chat_idx": {
          "name": "community_chat_messages_chat_idx",
          "columns": [
            {
              "expression": "chat_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "community_chat_messages_chat_id_community_chats_id_fk": {
          "name": "community_chat_messages_chat_id_community_chats_id_fk",
          "tableFrom": "community_chat_messages",
          "tableTo": "community_chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "community_chat_messages_author_id_users_id_fk": {
          "name": "community_chat_messages_author_id_users_id_fk",
          "tableFrom": "community_chat_messages",
          "tableTo": "users",
          "columnsFrom": [
            "author_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_chats": {
      "name": "community_chats",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(64)",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_by_id": {
          "name": "created_by_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "community_chats_created_by_id_users_id_fk": {
          "name": "community_chats_created_by_id_users_id_fk",
          "tableFrom": "community_chats",
          "tableTo": "users",
          "columnsFrom": [
            "created_by_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_post_comments": {
      "name": "community_post_comments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "legacy_id": {
          "name": "legacy_id",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "post_id": {
          "name": "post_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "author_id": {
          "name": "author_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "author_name": {
          "name": "author_name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "community_post_comments_legacy_id_unique": {
          "name": "community_post_comments_legacy_id_unique",
          "columns": [
            {
              "expression": "legacy_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "community_post_comments_post_idx": {
          "name": "community_post_comments_post_idx",
          "columns": [
            {
              "expression": "post_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "community_post_comments_post_id_community_posts_id_fk": {
          "name": "community_post_comments_post_id_community_posts_id_fk",
          "tableFrom": "community_post_comments",
          "tableTo": "community_posts",
          "columnsFrom": [
            "post_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "community_post_comments_author_id_users_id_fk": {
          "name": "community_post_comments_author_id_users_id_fk",
          "tableFrom": "community_post_comments",
          "tableTo": "users",
          "columnsFrom": [
            "author_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_post_likes": {
      "name": "community_post_likes",
      "schema": "",
      "columns": {
        "post_id": {
          "name": "post_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "community_post_likes_post_id_community_posts_id_fk": {
          "name": "community_post_likes_post_id_community_posts_id_fk",
          "tableFrom": "community_post_likes",
          "tableTo": "community_posts",
          "columnsFrom": [
            "post_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "community_post_likes_user_id_users_id_fk": {
          "name": "community_post_likes_user_id_users_id_fk",
          "tableFrom": "community_post_likes",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "community_post_likes_post_id_user_id_pk": {
          "name": "community_post_likes_post_id_user_id_pk",
          "columns": [
            "post_id",
            "user_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_posts": {
      "name": "community_posts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "legacy_id": {
          "name": "legacy_id",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "channel_id": {
          "name": "channel_id",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "post_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'DRAFT'"
        },
        "variant": {
          "name": "variant",
          "type": "post_variant",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'FULL'"
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "excerpt": {
          "name": "excerpt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "cover": {
          "name": "cover",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "author_id": {
          "name": "author_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "author_name": {
          "name": "author_name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": false
        },
        "published_at": {
          "name": "published_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "legacy_date": {
          "name": "legacy_date",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "source_path": {
          "name": "source_path",
          "type": "varchar(400)",
          "primaryKey": false,
          "notNull": false
        },
        "source_hash": {
          "name": "source_hash",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "views": {
          "name": "views",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "community_posts_legacy_id_unique": {
          "name": "community_posts_legacy_id_unique",
          "columns": [
            {
              "expression": "legacy_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "community_posts_source_path_unique": {
          "name": "community_posts_source_path_unique",
          "columns": [
            {
              "expression": "source_path",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "community_posts_channel_idx": {
          "name": "community_posts_channel_idx",
          "columns": [
            {
              "expression": "channel_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "community_posts_status_published_idx": {
          "name": "community_posts_status_published_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "published_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "community_posts_channel_id_community_channels_id_fk": {
          "name": "community_posts_channel_id_community_channels_id_fk",
          "tableFrom": "community_posts",
          "tableTo": "community_channels",
          "columnsFrom": [
            "channel_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        },
        "community_posts_author_id_users_id_fk": {
          "name": "community_posts_author_id_users_id_fk",
          "tableFrom": "community_posts",
          "tableTo": "users",
          "columnsFrom": [
            "author_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.community_settings": {
      "name": "community_settings",
      "schema": "",
      "columns": {
        "key": {
          "name": "key",
          "type": "varchar(64)",
          "primaryKey": true,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.attachments": {
      "name": "attachments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "attachment_kind",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "object_key": {
          "name": "object_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "original_name": {
          "name": "original_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "mime_type": {
          "name": "mime_type",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true
        },
        "byte_size": {
          "name": "byte_size",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "attachments_object_key_unique": {
          "name": "attachments_object_key_unique",
          "columns": [
            {
              "expression": "object_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "attachments_owner_entity_idx": {
          "name": "attachments_owner_entity_idx",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "entity_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "attachments_owner_id_users_id_fk": {
          "name": "attachments_owner_id_users_id_fk",
          "tableFrom": "attachments",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.audit_events": {
      "name": "audit_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "actor_user_id": {
          "name": "actor_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "ip_address": {
          "name": "ip_address",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "audit_events_actor_created_idx": {
          "name": "audit_events_actor_created_idx",
          "columns": [
            {
              "expression": "actor_user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "audit_events_entity_idx": {
          "name": "audit_events_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": {}
        }
      },
      "foreignKeys": {
        "audit_events_actor_user_id_users_id_fk": {
          "name": "audit_events_actor_user_id_users_id_fk",
          "tableFrom": "audit_events",
          "tableTo": "users",
          "columnsFrom": [
            "actor_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.portfolio_transactions": {
      "name": "portfolio_transactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "portfolio_id": {
          "name": "portfolio_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "portfolio_transaction_type",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "asset": {
          "name": "asset",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": false
        },
        "quantity": {
          "name": "quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "price": {
          "name": "price",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(12)",
          "primaryKey": false,
          "notNull": false
        },
        "fee_quantity": {
          "name": "fee_quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "fee_asset": {
          "name": "fee_asset",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": false
        },
        "cash_amount": {
          "name": "cash_amount",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "cash_currency": {
          "name": "cash_currency",
          "type": "varchar(12)",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "portfolio_transactions_portfolio_date_idx": {
          "name": "portfolio_transactions_portfolio_date_idx",
          "columns": [
            {
              "expression": "portfolio_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "portfolio_transactions_asset_idx": {
          "name": "portfolio_transactions_asset_idx",
          "columns": [
            {
              "expression": "asset",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "portfolio_transactions_portfolio_id_portfolios_id_fk": {
          "name": "portfolio_transactions_portfolio_id_portfolios_id_fk",
          "tableFrom": "portfolio_transactions",
          "tableTo": "portfolios",
          "columnsFrom": [
            "portfolio_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.portfolios": {
      "name": "portfolios",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "portfolios_owner_id_idx": {
          "name": "portfolios_owner_id_idx",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "portfolios_owner_name_unique": {
          "name": "portfolios_owner_name_unique",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "portfolios_owner_id_users_id_fk": {
          "name": "portfolios_owner_id_users_id_fk",
          "tableFrom": "portfolios",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.app_state": {
      "name": "app_state",
      "schema": "",
      "columns": {
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "app_state_owner_id_users_id_fk": {
          "name": "app_state_owner_id_users_id_fk",
          "tableFrom": "app_state",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "app_state_owner_id_key_pk": {
          "name": "app_state_owner_id_key_pk",
          "columns": [
            "owner_id",
            "key"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trade_additions": {
      "name": "trade_additions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "trade_id": {
          "name": "trade_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "price": {
          "name": "price",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "margin": {
          "name": "margin",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trade_additions_trade_id_idx": {
          "name": "trade_additions_trade_id_idx",
          "columns": [
            {
              "expression": "trade_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trade_additions_trade_id_trades_id_fk": {
          "name": "trade_additions_trade_id_trades_id_fk",
          "tableFrom": "trade_additions",
          "tableTo": "trades",
          "columnsFrom": [
            "trade_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trade_partials": {
      "name": "trade_partials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "trade_id": {
          "name": "trade_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "price": {
          "name": "price",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "pnl": {
          "name": "pnl",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trade_partials_trade_id_idx": {
          "name": "trade_partials_trade_id_idx",
          "columns": [
            {
              "expression": "trade_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trade_partials_trade_id_trades_id_fk": {
          "name": "trade_partials_trade_id_trades_id_fk",
          "tableFrom": "trade_partials",
          "tableTo": "trades",
          "columnsFrom": [
            "trade_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trades": {
      "name": "trades",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "account_id": {
          "name": "account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "open_date": {
          "name": "open_date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "close_date": {
          "name": "close_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "asset": {
          "name": "asset",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true
        },
        "direction": {
          "name": "direction",
          "type": "trade_direction",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "trade_type": {
          "name": "trade_type",
          "type": "trade_type",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "result": {
          "name": "result",
          "type": "trade_result",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "entry": {
          "name": "entry",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "exit": {
          "name": "exit",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "stop_loss": {
          "name": "stop_loss",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "take_profit": {
          "name": "take_profit",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "liquidation_price": {
          "name": "liquidation_price",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "leverage": {
          "name": "leverage",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "capital": {
          "name": "capital",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "quantity": {
          "name": "quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "base_quantity": {
          "name": "base_quantity",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "base_entry": {
          "name": "base_entry",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "base_capital": {
          "name": "base_capital",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "pnl": {
          "name": "pnl",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "setup": {
          "name": "setup",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "emotion": {
          "name": "emotion",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trades_account_id_idx": {
          "name": "trades_account_id_idx",
          "columns": [
            {
              "expression": "account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "trades_account_open_date_idx": {
          "name": "trades_account_open_date_idx",
          "columns": [
            {
              "expression": "account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "open_date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "trades_account_result_idx": {
          "name": "trades_account_result_idx",
          "columns": [
            {
              "expression": "account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "result",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "trades_asset_idx": {
          "name": "trades_asset_idx",
          "columns": [
            {
              "expression": "asset",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trades_account_id_trading_accounts_id_fk": {
          "name": "trades_account_id_trading_accounts_id_fk",
          "tableFrom": "trades",
          "tableTo": "trading_accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trading_accounts": {
      "name": "trading_accounts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true
        },
        "color": {
          "name": "color",
          "type": "varchar(24)",
          "primaryKey": false,
          "notNull": false
        },
        "exchange": {
          "name": "exchange",
          "type": "varchar(80)",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trading_accounts_owner_id_idx": {
          "name": "trading_accounts_owner_id_idx",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "trading_accounts_owner_name_unique": {
          "name": "trading_accounts_owner_name_unique",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trading_accounts_owner_id_users_id_fk": {
          "name": "trading_accounts_owner_id_users_id_fk",
          "tableFrom": "trading_accounts",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trading_cash_transactions": {
      "name": "trading_cash_transactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "account_id": {
          "name": "account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "trading_cash_transaction_type",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "varchar(12)",
          "primaryKey": false,
          "notNull": true
        },
        "to_currency": {
          "name": "to_currency",
          "type": "varchar(12)",
          "primaryKey": false,
          "notNull": false
        },
        "to_amount": {
          "name": "to_amount",
          "type": "numeric(38, 18)",
          "primaryKey": false,
          "notNull": false
        },
        "counterparty": {
          "name": "counterparty",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trading_cash_transactions_account_id_idx": {
          "name": "trading_cash_transactions_account_id_idx",
          "columns": [
            {
              "expression": "account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trading_cash_transactions_account_id_trading_accounts_id_fk": {
          "name": "trading_cash_transactions_account_id_trading_accounts_id_fk",
          "tableFrom": "trading_cash_transactions",
          "tableTo": "trading_accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.watchlist_items": {
      "name": "watchlist_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "watchlist_id": {
          "name": "watchlist_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "coin_id": {
          "name": "coin_id",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true
        },
        "symbol": {
          "name": "symbol",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true
        },
        "position": {
          "name": "position",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "watchlist_items_watchlist_coin_unique": {
          "name": "watchlist_items_watchlist_coin_unique",
          "columns": [
            {
              "expression": "watchlist_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "coin_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "watchlist_items_watchlist_position_idx": {
          "name": "watchlist_items_watchlist_position_idx",
          "columns": [
            {
              "expression": "watchlist_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "position",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "watchlist_items_watchlist_id_watchlists_id_fk": {
          "name": "watchlist_items_watchlist_id_watchlists_id_fk",
          "tableFrom": "watchlist_items",
          "tableTo": "watchlists",
          "columnsFrom": [
            "watchlist_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.watchlists": {
      "name": "watchlists",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "watchlists_owner_id_idx": {
          "name": "watchlists_owner_id_idx",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "watchlists_owner_name_unique": {
          "name": "watchlists_owner_name_unique",
          "columns": [
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "watchlists_owner_id_users_id_fk": {
          "name": "watchlists_owner_id_users_id_fk",
          "tableFrom": "watchlists",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.attachment_kind": {
      "name": "attachment_kind",
      "schema": "public",
      "values": [
        "TRADE_CHART",
        "STRATEGY_IMAGE"
      ]
    },
    "public.channel_visibility": {
      "name": "channel_visibility",
      "schema": "public",
      "values": [
        "MEMBERS",
        "ADMINS"
      ]
    },
    "public.module_access_level": {
      "name": "module_access_level",
      "schema": "public",
      "values": [
        "NONE",
        "READ",
        "WRITE"
      ]
    },
    "public.portfolio_transaction_type": {
      "name": "portfolio_transaction_type",
      "schema": "public",
      "values": [
        "buy",
        "sell",
        "deposit",
        "withdrawal",
        "order-buy",
        "order-sell"
      ]
    },
    "public.post_status": {
      "name": "post_status",
      "schema": "public",
      "values": [
        "DRAFT",
        "PUBLISHED"
      ]
    },
    "public.post_variant": {
      "name": "post_variant",
      "schema": "public",
      "values": [
        "FULL",
        "SHORT"
      ]
    },
    "public.trade_direction": {
      "name": "trade_direction",
      "schema": "public",
      "values": [
        "LONG",
        "SHORT"
      ]
    },
    "public.trade_result": {
      "name": "trade_result",
      "schema": "public",
      "values": [
        "OPEN",
        "WIN",
        "LOSS",
        "BREAKEVEN",
        "ORDER"
      ]
    },
    "public.trade_type": {
      "name": "trade_type",
      "schema": "public",
      "values": [
        "Scalp",
        "Daytrade",
        "Swing"
      ]
    },
    "public.trading_cash_transaction_type": {
      "name": "trading_cash_transaction_type",
      "schema": "public",
      "values": [
        "deposit",
        "withdrawal",
        "conversion"
      ]
    },
    "public.user_role": {
      "name": "user_role",
      "schema": "public",
      "values": [
        "USER",
        "ADMIN"
      ]
    }
  },
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}