{
  "id": "bcd8b541-814a-4dfb-8cb8-b677d1218da4",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "actor": {
          "name": "actor",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "meta": {
          "name": "meta",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "audit_logs_instance_created_idx": {
          "name": "audit_logs_instance_created_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "audit_logs_instance_id_push_instances_id_fk": {
          "name": "audit_logs_instance_id_push_instances_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "push_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.delivery_attempts": {
      "name": "delivery_attempts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "delivery_job_id": {
          "name": "delivery_job_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "device_id": {
          "name": "device_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "attempt_provider",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "attempt_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "provider_message_id": {
          "name": "provider_message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error_code": {
          "name": "error_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sent_at": {
          "name": "sent_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": {
        "delivery_attempts_job_idx": {
          "name": "delivery_attempts_job_idx",
          "columns": [
            {
              "expression": "delivery_job_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "delivery_attempts_device_idx": {
          "name": "delivery_attempts_device_idx",
          "columns": [
            {
              "expression": "device_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "delivery_attempts_delivery_job_id_delivery_jobs_id_fk": {
          "name": "delivery_attempts_delivery_job_id_delivery_jobs_id_fk",
          "tableFrom": "delivery_attempts",
          "tableTo": "delivery_jobs",
          "columnsFrom": [
            "delivery_job_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "delivery_attempts_device_id_push_devices_id_fk": {
          "name": "delivery_attempts_device_id_push_devices_id_fk",
          "tableFrom": "delivery_attempts",
          "tableTo": "push_devices",
          "columnsFrom": [
            "device_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.delivery_jobs": {
      "name": "delivery_jobs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "delivery_job_id": {
          "name": "delivery_job_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "idempotency_key": {
          "name": "idempotency_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "delivery_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'accepted'"
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "collapse_key": {
          "name": "collapse_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ttl_seconds": {
          "name": "ttl_seconds",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 3600
        },
        "accepted_count": {
          "name": "accepted_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "rejected_count": {
          "name": "rejected_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "sent_count": {
          "name": "sent_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "failed_count": {
          "name": "failed_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "last_error_code": {
          "name": "last_error_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_error_message": {
          "name": "last_error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_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": {
        "delivery_jobs_delivery_job_id_idx": {
          "name": "delivery_jobs_delivery_job_id_idx",
          "columns": [
            {
              "expression": "delivery_job_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "delivery_jobs_instance_idempotency_idx": {
          "name": "delivery_jobs_instance_idempotency_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "idempotency_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "delivery_jobs_instance_created_idx": {
          "name": "delivery_jobs_instance_created_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "delivery_jobs_instance_id_push_instances_id_fk": {
          "name": "delivery_jobs_instance_id_push_instances_id_fk",
          "tableFrom": "delivery_jobs",
          "tableTo": "push_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "delivery_jobs_delivery_job_id_unique": {
          "name": "delivery_jobs_delivery_job_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "delivery_job_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.push_devices": {
      "name": "push_devices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "central_device_id": {
          "name": "central_device_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "local_device_id": {
          "name": "local_device_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "platform": {
          "name": "platform",
          "type": "device_platform",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "device_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "provider_token_encrypted": {
          "name": "provider_token_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "web_push_subscription": {
          "name": "web_push_subscription",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "meta": {
          "name": "meta",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "last_seen_at": {
          "name": "last_seen_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "disabled_at": {
          "name": "disabled_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": {
        "push_devices_central_device_id_idx": {
          "name": "push_devices_central_device_id_idx",
          "columns": [
            {
              "expression": "central_device_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "push_devices_instance_local_device_idx": {
          "name": "push_devices_instance_local_device_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "local_device_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "push_devices_instance_status_idx": {
          "name": "push_devices_instance_status_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "push_devices_instance_id_push_instances_id_fk": {
          "name": "push_devices_instance_id_push_instances_id_fk",
          "tableFrom": "push_devices",
          "tableTo": "push_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "push_devices_central_device_id_unique": {
          "name": "push_devices_central_device_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "central_device_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.push_instances": {
      "name": "push_instances",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "instance_id": {
          "name": "instance_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "base_url": {
          "name": "base_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "instance_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "payload_mode": {
          "name": "payload_mode",
          "type": "payload_mode",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'minimal'"
        },
        "capabilities": {
          "name": "capabilities",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "rate_limit_per_minute": {
          "name": "rate_limit_per_minute",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 120
        },
        "daily_quota": {
          "name": "daily_quota",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 10000
        },
        "current_secret_encrypted": {
          "name": "current_secret_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "current_secret_preview": {
          "name": "current_secret_preview",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "next_secret_encrypted": {
          "name": "next_secret_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "next_secret_preview": {
          "name": "next_secret_preview",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_heartbeat_at": {
          "name": "last_heartbeat_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_heartbeat_version": {
          "name": "last_heartbeat_version",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_heartbeat_ip": {
          "name": "last_heartbeat_ip",
          "type": "text",
          "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": {
        "push_instances_instance_id_idx": {
          "name": "push_instances_instance_id_idx",
          "columns": [
            {
              "expression": "instance_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "push_instances_status_idx": {
          "name": "push_instances_status_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "push_instances_instance_id_unique": {
          "name": "push_instances_instance_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "instance_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.attempt_provider": {
      "name": "attempt_provider",
      "schema": "public",
      "values": [
        "web_push",
        "apns",
        "fcm"
      ]
    },
    "public.attempt_status": {
      "name": "attempt_status",
      "schema": "public",
      "values": [
        "pending",
        "sent",
        "failed",
        "skipped"
      ]
    },
    "public.delivery_status": {
      "name": "delivery_status",
      "schema": "public",
      "values": [
        "accepted",
        "processing",
        "completed",
        "failed",
        "partial"
      ]
    },
    "public.device_platform": {
      "name": "device_platform",
      "schema": "public",
      "values": [
        "web",
        "ios",
        "android"
      ]
    },
    "public.device_status": {
      "name": "device_status",
      "schema": "public",
      "values": [
        "active",
        "disabled",
        "invalid"
      ]
    },
    "public.instance_status": {
      "name": "instance_status",
      "schema": "public",
      "values": [
        "active",
        "blocked",
        "disabled"
      ]
    },
    "public.payload_mode": {
      "name": "payload_mode",
      "schema": "public",
      "values": [
        "minimal",
        "rich"
      ]
    }
  },
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}