{
  "version": "6",
  "dialect": "sqlite",
  "id": "de3226f5-0e45-4150-b3b6-97587fc43a7c",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "tables": {
    "brands": {
      "name": "brands",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "owner_id": {
          "name": "owner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'#7657e8'"
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_brands_owner": {
          "name": "idx_brands_owner",
          "columns": [
            "owner_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "oauth_states": {
      "name": "oauth_states",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "owner_id": {
          "name": "owner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "brand_id": {
          "name": "brand_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_oauth_states_expiry": {
          "name": "idx_oauth_states_expiry",
          "columns": [
            "expires_at"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "oauth_states_brand_id_brands_id_fk": {
          "name": "oauth_states_brand_id_brands_id_fk",
          "tableFrom": "oauth_states",
          "tableTo": "brands",
          "columnsFrom": [
            "brand_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "scheduled_post_targets": {
      "name": "scheduled_post_targets",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "post_id": {
          "name": "post_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "account_id": {
          "name": "account_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'scheduled'"
        },
        "external_post_id": {
          "name": "external_post_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "published_at": {
          "name": "published_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_post_targets_post": {
          "name": "idx_post_targets_post",
          "columns": [
            "post_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "scheduled_post_targets_post_id_scheduled_posts_id_fk": {
          "name": "scheduled_post_targets_post_id_scheduled_posts_id_fk",
          "tableFrom": "scheduled_post_targets",
          "tableTo": "scheduled_posts",
          "columnsFrom": [
            "post_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "scheduled_post_targets_account_id_social_accounts_id_fk": {
          "name": "scheduled_post_targets_account_id_social_accounts_id_fk",
          "tableFrom": "scheduled_post_targets",
          "tableTo": "social_accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "scheduled_posts": {
      "name": "scheduled_posts",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "owner_id": {
          "name": "owner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "brand_id": {
          "name": "brand_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "media_url": {
          "name": "media_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "media_type": {
          "name": "media_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "alt_text": {
          "name": "alt_text",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "scheduled_for": {
          "name": "scheduled_for",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "timezone": {
          "name": "timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'Asia/Seoul'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'scheduled'"
        },
        "published_at": {
          "name": "published_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_scheduled_posts_owner_brand": {
          "name": "idx_scheduled_posts_owner_brand",
          "columns": [
            "owner_id",
            "brand_id"
          ],
          "isUnique": false
        },
        "idx_scheduled_posts_due": {
          "name": "idx_scheduled_posts_due",
          "columns": [
            "status",
            "scheduled_for"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "scheduled_posts_brand_id_brands_id_fk": {
          "name": "scheduled_posts_brand_id_brands_id_fk",
          "tableFrom": "scheduled_posts",
          "tableTo": "brands",
          "columnsFrom": [
            "brand_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "social_accounts": {
      "name": "social_accounts",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "owner_id": {
          "name": "owner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "brand_id": {
          "name": "brand_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "platform_user_id": {
          "name": "platform_user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "profile_image_url": {
          "name": "profile_image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "token_encrypted": {
          "name": "token_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "token_iv": {
          "name": "token_iv",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "token_expires_at": {
          "name": "token_expires_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'connected'"
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_social_accounts_brand": {
          "name": "idx_social_accounts_brand",
          "columns": [
            "owner_id",
            "brand_id"
          ],
          "isUnique": false
        },
        "idx_social_accounts_brand_platform_user": {
          "name": "idx_social_accounts_brand_platform_user",
          "columns": [
            "brand_id",
            "platform",
            "platform_user_id"
          ],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "social_accounts_brand_id_brands_id_fk": {
          "name": "social_accounts_brand_id_brands_id_fk",
          "tableFrom": "social_accounts",
          "tableTo": "brands",
          "columnsFrom": [
            "brand_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    }
  },
  "views": {},
  "enums": {},
  "_meta": {
    "schemas": {},
    "tables": {},
    "columns": {}
  },
  "internal": {
    "indexes": {}
  }
}