{
  "id": "cf84df4b-a613-4f81-80bf-330af541e54f",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.analytics_events": {
      "name": "analytics_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "analytics_events_kind_idx": {
          "name": "analytics_events_kind_idx",
          "columns": [
            {
              "expression": "kind",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.article_corrections": {
      "name": "article_corrections",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "revision_id": {
          "name": "revision_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "responsible_user_id": {
          "name": "responsible_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": {
        "article_corrections_article_id_articles_id_fk": {
          "name": "article_corrections_article_id_articles_id_fk",
          "tableFrom": "article_corrections",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "article_corrections_revision_id_article_revisions_id_fk": {
          "name": "article_corrections_revision_id_article_revisions_id_fk",
          "tableFrom": "article_corrections",
          "tableTo": "article_revisions",
          "columnsFrom": [
            "revision_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.article_revisions": {
      "name": "article_revisions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "revision": {
          "name": "revision",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "summary": {
          "name": "summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "change_kind": {
          "name": "change_kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'edit'"
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "content_hash": {
          "name": "content_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "editor_id": {
          "name": "editor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "article_revisions_uidx": {
          "name": "article_revisions_uidx",
          "columns": [
            {
              "expression": "article_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "revision",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "article_revisions_article_id_articles_id_fk": {
          "name": "article_revisions_article_id_articles_id_fk",
          "tableFrom": "article_revisions",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.article_workflow_events": {
      "name": "article_workflow_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "from_status": {
          "name": "from_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "to_status": {
          "name": "to_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "actor_id": {
          "name": "actor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "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": {},
      "foreignKeys": {
        "article_workflow_events_article_id_articles_id_fk": {
          "name": "article_workflow_events_article_id_articles_id_fk",
          "tableFrom": "article_workflow_events",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.articles": {
      "name": "articles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "summary": {
          "name": "summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content_type": {
          "name": "content_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'news'"
        },
        "category_key": {
          "name": "category_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "topic_keys": {
          "name": "topic_keys",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "tag_keys": {
          "name": "tag_keys",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "cover_url": {
          "name": "cover_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cover_alt": {
          "name": "cover_alt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "audio_url": {
          "name": "audio_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "audio_duration_sec": {
          "name": "audio_duration_sec",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "video_url": {
          "name": "video_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "dataset_ids": {
          "name": "dataset_ids",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "source_refs": {
          "name": "source_refs",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "author_id": {
          "name": "author_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "scheduled_for": {
          "name": "scheduled_for",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "published_at": {
          "name": "published_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "published_by": {
          "name": "published_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "editable_until": {
          "name": "editable_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "is_locked": {
          "name": "is_locked",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "current_revision": {
          "name": "current_revision",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "view_count": {
          "name": "view_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "discussion_count": {
          "name": "discussion_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "save_count": {
          "name": "save_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_breaking": {
          "name": "is_breaking",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_featured": {
          "name": "is_featured",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "data_source": {
          "name": "data_source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'demo'"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "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": {
        "articles_slug_uidx": {
          "name": "articles_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "articles_status_idx": {
          "name": "articles_status_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": {
        "articles_region_id_regions_id_fk": {
          "name": "articles_region_id_regions_id_fk",
          "tableFrom": "articles",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "articles_organization_id_organizations_id_fk": {
          "name": "articles_organization_id_organizations_id_fk",
          "tableFrom": "articles",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "articles_business_id_businesses_id_fk": {
          "name": "articles_business_id_businesses_id_fk",
          "tableFrom": "articles",
          "tableTo": "businesses",
          "columnsFrom": [
            "business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "articles_author_id_users_id_fk": {
          "name": "articles_author_id_users_id_fk",
          "tableFrom": "articles",
          "tableTo": "users",
          "columnsFrom": [
            "author_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "actor_id": {
          "name": "actor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "actor_label": {
          "name": "actor_label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "before": {
          "name": "before",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "after": {
          "name": "after",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "audit_logs_action_idx": {
          "name": "audit_logs_action_idx",
          "columns": [
            {
              "expression": "action",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "audit_logs_entity_idx": {
          "name": "audit_logs_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": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.bookmarks": {
      "name": "bookmarks",
      "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
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "bookmarks_uidx": {
          "name": "bookmarks_uidx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "article_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "bookmarks_user_id_users_id_fk": {
          "name": "bookmarks_user_id_users_id_fk",
          "tableFrom": "bookmarks",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "bookmarks_article_id_articles_id_fk": {
          "name": "bookmarks_article_id_articles_id_fk",
          "tableFrom": "bookmarks",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.business_offerings": {
      "name": "business_offerings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'service'"
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "price_label": {
          "name": "price_label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "business_offerings_business_id_businesses_id_fk": {
          "name": "business_offerings_business_id_businesses_id_fk",
          "tableFrom": "business_offerings",
          "tableTo": "businesses",
          "columnsFrom": [
            "business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.businesses": {
      "name": "businesses",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category_key": {
          "name": "category_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "guild_id": {
          "name": "guild_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "owner_user_id": {
          "name": "owner_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "owner_name_public": {
          "name": "owner_name_public",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "manager_user_id": {
          "name": "manager_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "logo_url": {
          "name": "logo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "website": {
          "name": "website",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "socials": {
          "name": "socials",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "verification_status": {
          "name": "verification_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unverified'"
        },
        "location_verified": {
          "name": "location_verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "identity_verified": {
          "name": "identity_verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "data_source": {
          "name": "data_source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'demo'"
        },
        "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": {
        "businesses_slug_uidx": {
          "name": "businesses_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "businesses_guild_id_guilds_id_fk": {
          "name": "businesses_guild_id_guilds_id_fk",
          "tableFrom": "businesses",
          "tableTo": "guilds",
          "columnsFrom": [
            "guild_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "businesses_owner_user_id_users_id_fk": {
          "name": "businesses_owner_user_id_users_id_fk",
          "tableFrom": "businesses",
          "tableTo": "users",
          "columnsFrom": [
            "owner_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "businesses_manager_user_id_users_id_fk": {
          "name": "businesses_manager_user_id_users_id_fk",
          "tableFrom": "businesses",
          "tableTo": "users",
          "columnsFrom": [
            "manager_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "businesses_region_id_regions_id_fk": {
          "name": "businesses_region_id_regions_id_fk",
          "tableFrom": "businesses",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.case_events": {
      "name": "case_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "case_id": {
          "name": "case_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "from_value": {
          "name": "from_value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "to_value": {
          "name": "to_value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "actor_id": {
          "name": "actor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "visibility": {
          "name": "visibility",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'public'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "case_events_case_id_cases_id_fk": {
          "name": "case_events_case_id_cases_id_fk",
          "tableFrom": "case_events",
          "tableTo": "cases",
          "columnsFrom": [
            "case_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.cases": {
      "name": "cases",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "case_code": {
          "name": "case_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "report_id": {
          "name": "report_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "department_id": {
          "name": "department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "assignee_user_id": {
          "name": "assignee_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'accepted'"
        },
        "sla_due_at": {
          "name": "sla_due_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "sla_breached_at": {
          "name": "sla_breached_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "escalation_level": {
          "name": "escalation_level",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "resolution_note": {
          "name": "resolution_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "closed_at": {
          "name": "closed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "reopen_count": {
          "name": "reopen_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "visibility": {
          "name": "visibility",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'public'"
        },
        "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": {
        "cases_code_uidx": {
          "name": "cases_code_uidx",
          "columns": [
            {
              "expression": "case_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "cases_org_idx": {
          "name": "cases_org_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "cases_report_id_reports_id_fk": {
          "name": "cases_report_id_reports_id_fk",
          "tableFrom": "cases",
          "tableTo": "reports",
          "columnsFrom": [
            "report_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "cases_organization_id_organizations_id_fk": {
          "name": "cases_organization_id_organizations_id_fk",
          "tableFrom": "cases",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "cases_department_id_departments_id_fk": {
          "name": "cases_department_id_departments_id_fk",
          "tableFrom": "cases",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "cases_business_id_businesses_id_fk": {
          "name": "cases_business_id_businesses_id_fk",
          "tableFrom": "cases",
          "tableTo": "businesses",
          "columnsFrom": [
            "business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "cases_assignee_user_id_users_id_fk": {
          "name": "cases_assignee_user_id_users_id_fk",
          "tableFrom": "cases",
          "tableTo": "users",
          "columnsFrom": [
            "assignee_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.comments": {
      "name": "comments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "case_id": {
          "name": "case_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "moderated_by": {
          "name": "moderated_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "comments_article_id_articles_id_fk": {
          "name": "comments_article_id_articles_id_fk",
          "tableFrom": "comments",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "comments_user_id_users_id_fk": {
          "name": "comments_user_id_users_id_fk",
          "tableFrom": "comments",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.communication_channels": {
      "name": "communication_channels",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "department_id": {
          "name": "department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "handle": {
          "name": "handle",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "owner_name": {
          "name": "owner_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "verification_status": {
          "name": "verification_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unverified'"
        },
        "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()"
        }
      },
      "indexes": {
        "comm_channels_org_idx": {
          "name": "comm_channels_org_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "communication_channels_organization_id_organizations_id_fk": {
          "name": "communication_channels_organization_id_organizations_id_fk",
          "tableFrom": "communication_channels",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "communication_channels_department_id_departments_id_fk": {
          "name": "communication_channels_department_id_departments_id_fk",
          "tableFrom": "communication_channels",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.dataset_points": {
      "name": "dataset_points",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "dataset_id": {
          "name": "dataset_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "series_key": {
          "name": "series_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'default'"
        },
        "period_label": {
          "name": "period_label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "period_start": {
          "name": "period_start",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "value": {
          "name": "value",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "dataset_points_ds_idx": {
          "name": "dataset_points_ds_idx",
          "columns": [
            {
              "expression": "dataset_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "series_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "dataset_points_dataset_id_datasets_id_fk": {
          "name": "dataset_points_dataset_id_datasets_id_fk",
          "tableFrom": "dataset_points",
          "tableTo": "datasets",
          "columnsFrom": [
            "dataset_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "dataset_points_region_id_regions_id_fk": {
          "name": "dataset_points_region_id_regions_id_fk",
          "tableFrom": "dataset_points",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.datasets": {
      "name": "datasets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title_fa": {
          "name": "title_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "unit": {
          "name": "unit",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_title": {
          "name": "source_title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_url": {
          "name": "source_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "publisher": {
          "name": "publisher",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "methodology": {
          "name": "methodology",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "geographic_scope": {
          "name": "geographic_scope",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "frequency": {
          "name": "frequency",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "chart_hint": {
          "name": "chart_hint",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'line'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "data_source": {
          "name": "data_source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'demo'"
        },
        "last_updated_at": {
          "name": "last_updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "datasets_slug_uidx": {
          "name": "datasets_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "datasets_organization_id_organizations_id_fk": {
          "name": "datasets_organization_id_organizations_id_fk",
          "tableFrom": "datasets",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.departments": {
      "name": "departments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unit'"
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lat": {
          "name": "lat",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "lng": {
          "name": "lng",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "departments_org_idx": {
          "name": "departments_org_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "departments_organization_id_organizations_id_fk": {
          "name": "departments_organization_id_organizations_id_fk",
          "tableFrom": "departments",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "departments_region_id_regions_id_fk": {
          "name": "departments_region_id_regions_id_fk",
          "tableFrom": "departments",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.follows": {
      "name": "follows",
      "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
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "follows_uidx": {
          "name": "follows_uidx",
          "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": {}
        }
      },
      "foreignKeys": {
        "follows_user_id_users_id_fk": {
          "name": "follows_user_id_users_id_fk",
          "tableFrom": "follows",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.guilds": {
      "name": "guilds",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'guild'"
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "guilds_slug_uidx": {
          "name": "guilds_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "guilds_region_id_regions_id_fk": {
          "name": "guilds_region_id_regions_id_fk",
          "tableFrom": "guilds",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "guilds_organization_id_organizations_id_fk": {
          "name": "guilds_organization_id_organizations_id_fk",
          "tableFrom": "guilds",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.media_assets": {
      "name": "media_assets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "storage_key": {
          "name": "storage_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "original_name": {
          "name": "original_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "mime_type": {
          "name": "mime_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "size_bytes": {
          "name": "size_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "checksum_sha256": {
          "name": "checksum_sha256",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "width": {
          "name": "width",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "height": {
          "name": "height",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "duration_sec": {
          "name": "duration_sec",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "alt_text": {
          "name": "alt_text",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "caption": {
          "name": "caption",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "copyright": {
          "name": "copyright",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "folder": {
          "name": "folder",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'/'"
        },
        "tags": {
          "name": "tags",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "visibility": {
          "name": "visibility",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'public'"
        },
        "scan_status": {
          "name": "scan_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "usage_count": {
          "name": "usage_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "uploaded_by": {
          "name": "uploaded_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.notifications": {
      "name": "notifications",
      "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
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "read_at": {
          "name": "read_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "notifications_user_idx": {
          "name": "notifications_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "read_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "notifications_user_id_users_id_fk": {
          "name": "notifications_user_id_users_id_fk",
          "tableFrom": "notifications",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.official_responses": {
      "name": "official_responses",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "case_id": {
          "name": "case_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "attachments": {
          "name": "attachments",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "source_ref": {
          "name": "source_ref",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "responder_user_id": {
          "name": "responder_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "responder_title": {
          "name": "responder_title",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'published'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "official_responses_case_id_cases_id_fk": {
          "name": "official_responses_case_id_cases_id_fk",
          "tableFrom": "official_responses",
          "tableTo": "cases",
          "columnsFrom": [
            "case_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "official_responses_organization_id_organizations_id_fk": {
          "name": "official_responses_organization_id_organizations_id_fk",
          "tableFrom": "official_responses",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "official_responses_business_id_businesses_id_fk": {
          "name": "official_responses_business_id_businesses_id_fk",
          "tableFrom": "official_responses",
          "tableTo": "businesses",
          "columnsFrom": [
            "business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organization_members": {
      "name": "organization_members",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "department_id": {
          "name": "department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "position": {
          "name": "position",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_official": {
          "name": "is_official",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_public": {
          "name": "is_public",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "org_members_uidx": {
          "name": "org_members_uidx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "organization_members_organization_id_organizations_id_fk": {
          "name": "organization_members_organization_id_organizations_id_fk",
          "tableFrom": "organization_members",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "organization_members_department_id_departments_id_fk": {
          "name": "organization_members_department_id_departments_id_fk",
          "tableFrom": "organization_members",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "organization_members_user_id_users_id_fk": {
          "name": "organization_members_user_id_users_id_fk",
          "tableFrom": "organization_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organization_messages": {
      "name": "organization_messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "from_organization_id": {
          "name": "from_organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "to_organization_id": {
          "name": "to_organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "from_department_id": {
          "name": "from_department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "to_department_id": {
          "name": "to_department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "deadline": {
          "name": "deadline",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "action_requested": {
          "name": "action_requested",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "related_case_id": {
          "name": "related_case_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "attachments": {
          "name": "attachments",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'sent'"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "organization_messages_from_organization_id_organizations_id_fk": {
          "name": "organization_messages_from_organization_id_organizations_id_fk",
          "tableFrom": "organization_messages",
          "tableTo": "organizations",
          "columnsFrom": [
            "from_organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "organization_messages_to_organization_id_organizations_id_fk": {
          "name": "organization_messages_to_organization_id_organizations_id_fk",
          "tableFrom": "organization_messages",
          "tableTo": "organizations",
          "columnsFrom": [
            "to_organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organization_services": {
      "name": "organization_services",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "department_id": {
          "name": "department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "service_key": {
          "name": "service_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "organization_services_organization_id_organizations_id_fk": {
          "name": "organization_services_organization_id_organizations_id_fk",
          "tableFrom": "organization_services",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "organization_services_department_id_departments_id_fk": {
          "name": "organization_services_department_id_departments_id_fk",
          "tableFrom": "organization_services",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organizations": {
      "name": "organizations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "short_name": {
          "name": "short_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "type_key": {
          "name": "type_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "logo_url": {
          "name": "logo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cover_url": {
          "name": "cover_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lat": {
          "name": "lat",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "lng": {
          "name": "lng",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "website": {
          "name": "website",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "verification_status": {
          "name": "verification_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unverified'"
        },
        "verified_at": {
          "name": "verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "verified_by": {
          "name": "verified_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "sla_config": {
          "name": "sla_config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{\"critical\":4,\"high\":24,\"normal\":72,\"low\":168}'::jsonb"
        },
        "escalation_policy": {
          "name": "escalation_policy",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{\"steps\":[]}'::jsonb"
        },
        "data_source": {
          "name": "data_source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'demo'"
        },
        "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": {
        "organizations_slug_uidx": {
          "name": "organizations_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "organizations_type_idx": {
          "name": "organizations_type_idx",
          "columns": [
            {
              "expression": "type_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "organizations_region_id_regions_id_fk": {
          "name": "organizations_region_id_regions_id_fk",
          "tableFrom": "organizations",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.outbound_messages": {
      "name": "outbound_messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "channel_id": {
          "name": "channel_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "state": {
          "name": "state",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'queued'"
        },
        "deep_link": {
          "name": "deep_link",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "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": {},
      "foreignKeys": {
        "outbound_messages_channel_id_communication_channels_id_fk": {
          "name": "outbound_messages_channel_id_communication_channels_id_fk",
          "tableFrom": "outbound_messages",
          "tableTo": "communication_channels",
          "columnsFrom": [
            "channel_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.permissions": {
      "name": "permissions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "group": {
          "name": "group",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "permissions_key_uidx": {
          "name": "permissions_key_uidx",
          "columns": [
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.reading_history": {
      "name": "reading_history",
      "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
        },
        "article_id": {
          "name": "article_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "progress": {
          "name": "progress",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "audio_position_sec": {
          "name": "audio_position_sec",
          "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": {},
      "foreignKeys": {
        "reading_history_user_id_users_id_fk": {
          "name": "reading_history_user_id_users_id_fk",
          "tableFrom": "reading_history",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "reading_history_article_id_articles_id_fk": {
          "name": "reading_history_article_id_articles_id_fk",
          "tableFrom": "reading_history",
          "tableTo": "articles",
          "columnsFrom": [
            "article_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.regions": {
      "name": "regions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "lat": {
          "name": "lat",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "lng": {
          "name": "lng",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "regions_slug_uidx": {
          "name": "regions_slug_uidx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.report_evidence": {
      "name": "report_evidence",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "report_id": {
          "name": "report_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "media_id": {
          "name": "media_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "caption": {
          "name": "caption",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "report_evidence_report_id_reports_id_fk": {
          "name": "report_evidence_report_id_reports_id_fk",
          "tableFrom": "report_evidence",
          "tableTo": "reports",
          "columnsFrom": [
            "report_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.reports": {
      "name": "reports",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "public_code": {
          "name": "public_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category_key": {
          "name": "category_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "severity": {
          "name": "severity",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "lat": {
          "name": "lat",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "lng": {
          "name": "lng",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reporter_user_id": {
          "name": "reporter_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "privacy": {
          "name": "privacy",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'public_after_review'"
        },
        "target_organization_id": {
          "name": "target_organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "target_business_id": {
          "name": "target_business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "moderation_note": {
          "name": "moderation_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "moderated_by": {
          "name": "moderated_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "duplicate_of_id": {
          "name": "duplicate_of_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "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": {
        "reports_code_uidx": {
          "name": "reports_code_uidx",
          "columns": [
            {
              "expression": "public_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "reports_status_idx": {
          "name": "reports_status_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "reports_region_id_regions_id_fk": {
          "name": "reports_region_id_regions_id_fk",
          "tableFrom": "reports",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "reports_reporter_user_id_users_id_fk": {
          "name": "reports_reporter_user_id_users_id_fk",
          "tableFrom": "reports",
          "tableTo": "users",
          "columnsFrom": [
            "reporter_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "reports_target_organization_id_organizations_id_fk": {
          "name": "reports_target_organization_id_organizations_id_fk",
          "tableFrom": "reports",
          "tableTo": "organizations",
          "columnsFrom": [
            "target_organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "reports_target_business_id_businesses_id_fk": {
          "name": "reports_target_business_id_businesses_id_fk",
          "tableFrom": "reports",
          "tableTo": "businesses",
          "columnsFrom": [
            "target_business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.role_permissions": {
      "name": "role_permissions",
      "schema": "",
      "columns": {
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "permission_id": {
          "name": "permission_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "role_permissions_role_id_roles_id_fk": {
          "name": "role_permissions_role_id_roles_id_fk",
          "tableFrom": "role_permissions",
          "tableTo": "roles",
          "columnsFrom": [
            "role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "role_permissions_permission_id_permissions_id_fk": {
          "name": "role_permissions_permission_id_permissions_id_fk",
          "tableFrom": "role_permissions",
          "tableTo": "permissions",
          "columnsFrom": [
            "permission_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "role_permissions_role_id_permission_id_pk": {
          "name": "role_permissions_role_id_permission_id_pk",
          "columns": [
            "role_id",
            "permission_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.roles": {
      "name": "roles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'global'"
        },
        "is_builtin": {
          "name": "is_builtin",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "roles_key_uidx": {
          "name": "roles_key_uidx",
          "columns": [
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.routing_rules": {
      "name": "routing_rules",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "match_category_key": {
          "name": "match_category_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "match_kind": {
          "name": "match_kind",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "match_severity": {
          "name": "match_severity",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "match_region_id": {
          "name": "match_region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "match_organization_type_key": {
          "name": "match_organization_type_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "match_keywords": {
          "name": "match_keywords",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "target_organization_id": {
          "name": "target_organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "target_department_id": {
          "name": "target_department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "target_guild_id": {
          "name": "target_guild_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "set_priority": {
          "name": "set_priority",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "routing_rules_target_organization_id_organizations_id_fk": {
          "name": "routing_rules_target_organization_id_organizations_id_fk",
          "tableFrom": "routing_rules",
          "tableTo": "organizations",
          "columnsFrom": [
            "target_organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "routing_rules_target_department_id_departments_id_fk": {
          "name": "routing_rules_target_department_id_departments_id_fk",
          "tableFrom": "routing_rules",
          "tableTo": "departments",
          "columnsFrom": [
            "target_department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "routing_rules_target_guild_id_guilds_id_fk": {
          "name": "routing_rules_target_guild_id_guilds_id_fk",
          "tableFrom": "routing_rules",
          "tableTo": "guilds",
          "columnsFrom": [
            "target_guild_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.saved_searches": {
      "name": "saved_searches",
      "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
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "query": {
          "name": "query",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "notify_enabled": {
          "name": "notify_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "last_checked_at": {
          "name": "last_checked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "saved_searches_user_id_users_id_fk": {
          "name": "saved_searches_user_id_users_id_fk",
          "tableFrom": "saved_searches",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.search_documents": {
      "name": "search_documents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "summary": {
          "name": "summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "normalized_text": {
          "name": "normalized_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "facets": {
          "name": "facets",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "published_at": {
          "name": "published_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "popularity": {
          "name": "popularity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "has_image": {
          "name": "has_image",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "has_video": {
          "name": "has_video",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "has_document": {
          "name": "has_document",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "search_documents_uidx": {
          "name": "search_documents_uidx",
          "columns": [
            {
              "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": {}
        },
        "search_documents_type_idx": {
          "name": "search_documents_type_idx",
          "columns": [
            {
              "expression": "entity_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.search_queries": {
      "name": "search_queries",
      "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": false
        },
        "raw_query": {
          "name": "raw_query",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "normalized_query": {
          "name": "normalized_query",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "result_count": {
          "name": "result_count",
          "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.search_synonyms": {
      "name": "search_synonyms",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "term": {
          "name": "term",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "synonyms": {
          "name": "synonyms",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "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": "text",
          "primaryKey": false,
          "notNull": true
        },
        "rotated_from": {
          "name": "rotated_from",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "revoked_at": {
          "name": "revoked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "sessions_token_uidx": {
          "name": "sessions_token_uidx",
          "columns": [
            {
              "expression": "token_hash",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "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.settings": {
      "name": "settings",
      "schema": "",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "uuid",
          "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.shops": {
      "name": "shops",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "business_id": {
          "name": "business_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_main_branch": {
          "name": "is_main_branch",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "region_id": {
          "name": "region_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lat": {
          "name": "lat",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "lng": {
          "name": "lng",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "opening_hours": {
          "name": "opening_hours",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "images": {
          "name": "images",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "shops_business_id_businesses_id_fk": {
          "name": "shops_business_id_businesses_id_fk",
          "tableFrom": "shops",
          "tableTo": "businesses",
          "columnsFrom": [
            "business_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "shops_region_id_regions_id_fk": {
          "name": "shops_region_id_regions_id_fk",
          "tableFrom": "shops",
          "tableTo": "regions",
          "columnsFrom": [
            "region_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tasks": {
      "name": "tasks",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "department_id": {
          "name": "department_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "assignee_user_id": {
          "name": "assignee_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "deadline": {
          "name": "deadline",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'open'"
        },
        "source_kind": {
          "name": "source_kind",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source_id": {
          "name": "source_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "related_case_id": {
          "name": "related_case_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "attachments": {
          "name": "attachments",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": 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": {},
      "foreignKeys": {
        "tasks_organization_id_organizations_id_fk": {
          "name": "tasks_organization_id_organizations_id_fk",
          "tableFrom": "tasks",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "tasks_department_id_departments_id_fk": {
          "name": "tasks_department_id_departments_id_fk",
          "tableFrom": "tasks",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "tasks_assignee_user_id_users_id_fk": {
          "name": "tasks_assignee_user_id_users_id_fk",
          "tableFrom": "tasks",
          "tableTo": "users",
          "columnsFrom": [
            "assignee_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "tasks_related_case_id_cases_id_fk": {
          "name": "tasks_related_case_id_cases_id_fk",
          "tableFrom": "tasks",
          "tableTo": "cases",
          "columnsFrom": [
            "related_case_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.taxonomies": {
      "name": "taxonomies",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name_fa": {
          "name": "name_fa",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "icon": {
          "name": "icon",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "order_index": {
          "name": "order_index",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "taxonomies_kind_key_uidx": {
          "name": "taxonomies_kind_key_uidx",
          "columns": [
            {
              "expression": "kind",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_roles": {
      "name": "user_roles",
      "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
        },
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "scope_type": {
          "name": "scope_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'global'"
        },
        "scope_id": {
          "name": "scope_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "granted_by": {
          "name": "granted_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "user_roles_user_idx": {
          "name": "user_roles_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "user_roles_scope_idx": {
          "name": "user_roles_scope_idx",
          "columns": [
            {
              "expression": "scope_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "scope_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "user_roles_user_id_users_id_fk": {
          "name": "user_roles_user_id_users_id_fk",
          "tableFrom": "user_roles",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "user_roles_role_id_roles_id_fk": {
          "name": "user_roles_role_id_roles_id_fk",
          "tableFrom": "user_roles",
          "tableTo": "roles",
          "columnsFrom": [
            "role_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": "text",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "handle": {
          "name": "handle",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "avatar_url": {
          "name": "avatar_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "bio": {
          "name": "bio",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "is_system": {
          "name": "is_system",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "failed_login_count": {
          "name": "failed_login_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "locked_until": {
          "name": "locked_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_login_at": {
          "name": "last_login_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "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_uidx": {
          "name": "users_email_uidx",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}