{
  "data": [
    "DROP INDEX \"IDX_baileys_stored_messages_session_created\"",
    "DROP INDEX \"UQ_baileys_stored_messages_session_wamsg\"",
    "CREATE TABLE \"temporary_baileys_stored_messages\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"waMessageId\" varchar NOT NULL, \"serializedMessage\" text NOT NULL, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')))",
    "INSERT INTO \"temporary_baileys_stored_messages\"(\"id\", \"sessionId\", \"waMessageId\", \"serializedMessage\", \"createdAt\") SELECT \"id\", \"sessionId\", \"waMessageId\", \"serializedMessage\", \"createdAt\" FROM \"baileys_stored_messages\"",
    "DROP TABLE \"baileys_stored_messages\"",
    "ALTER TABLE \"temporary_baileys_stored_messages\" RENAME TO \"baileys_stored_messages\"",
    "CREATE INDEX \"IDX_baileys_stored_messages_session_created\" ON \"baileys_stored_messages\" (\"sessionId\", \"createdAt\") ",
    "CREATE UNIQUE INDEX \"UQ_baileys_stored_messages_session_wamsg\" ON \"baileys_stored_messages\" (\"sessionId\", \"waMessageId\") ",
    "DROP INDEX \"IDX_templates_session_name\"",
    "DROP INDEX \"IDX_templates_sessionId\"",
    "CREATE TABLE \"temporary_templates\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"name\" varchar(100) NOT NULL, \"body\" text NOT NULL, \"header\" text, \"footer\" text, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')))",
    "INSERT INTO \"temporary_templates\"(\"id\", \"sessionId\", \"name\", \"body\", \"header\", \"footer\", \"createdAt\", \"updatedAt\") SELECT \"id\", \"sessionId\", \"name\", \"body\", \"header\", \"footer\", \"createdAt\", \"updatedAt\" FROM \"templates\"",
    "DROP TABLE \"templates\"",
    "ALTER TABLE \"temporary_templates\" RENAME TO \"templates\"",
    "CREATE UNIQUE INDEX \"IDX_templates_session_name\" ON \"templates\" (\"sessionId\", \"name\") ",
    "CREATE INDEX \"IDX_templates_sessionId\" ON \"templates\" (\"sessionId\") ",
    "DROP INDEX \"IDX_automation_rules_sessionId\"",
    "CREATE TABLE \"temporary_automation_rules\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"name\" varchar(100) NOT NULL, \"enabled\" boolean NOT NULL DEFAULT (1), \"conditions\" text, \"replyText\" text NOT NULL, \"cooldownSeconds\" integer NOT NULL DEFAULT (60), \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')))",
    "INSERT INTO \"temporary_automation_rules\"(\"id\", \"sessionId\", \"name\", \"enabled\", \"conditions\", \"replyText\", \"cooldownSeconds\", \"createdAt\", \"updatedAt\") SELECT \"id\", \"sessionId\", \"name\", \"enabled\", \"conditions\", \"replyText\", \"cooldownSeconds\", \"createdAt\", \"updatedAt\" FROM \"automation_rules\"",
    "DROP TABLE \"automation_rules\"",
    "ALTER TABLE \"temporary_automation_rules\" RENAME TO \"automation_rules\"",
    "CREATE INDEX \"IDX_automation_rules_sessionId\" ON \"automation_rules\" (\"sessionId\") ",
    "DROP INDEX \"IDX_baileys_stored_messages_session_created\"",
    "DROP INDEX \"UQ_baileys_stored_messages_session_wamsg\"",
    "DROP INDEX \"IDX_lid_mappings_phone\"",
    "DROP INDEX \"IDX_templates_sessionId\"",
    "DROP INDEX \"IDX_status_updates_expiresAt\"",
    "DROP INDEX \"UQ_status_updates_sessionId_waStatusId\"",
    "DROP INDEX \"IDX_status_updates_sessionId_contactJid\"",
    "DROP INDEX \"IDX_webhooks_sessionId\"",
    "CREATE TABLE \"temporary_webhooks\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"url\" varchar(2048) NOT NULL, \"events\" text NOT NULL DEFAULT ('[\"message.received\"]'), \"secret\" varchar(255), \"headers\" text NOT NULL DEFAULT ('{}'), \"active\" boolean NOT NULL DEFAULT (1), \"retryCount\" integer NOT NULL DEFAULT (3), \"lastTriggeredAt\" datetime, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')), \"filters\" text, CONSTRAINT \"FK_d209715bb62b12255e825580af6\" FOREIGN KEY (\"sessionId\") REFERENCES \"sessions\" (\"id\") ON DELETE CASCADE ON UPDATE NO ACTION)",
    "INSERT INTO \"temporary_webhooks\"(\"id\", \"sessionId\", \"url\", \"events\", \"secret\", \"headers\", \"active\", \"retryCount\", \"lastTriggeredAt\", \"createdAt\", \"updatedAt\", \"filters\") SELECT \"id\", \"sessionId\", \"url\", \"events\", \"secret\", \"headers\", \"active\", \"retryCount\", \"lastTriggeredAt\", \"createdAt\", \"updatedAt\", \"filters\" FROM \"webhooks\"",
    "DROP TABLE \"webhooks\"",
    "ALTER TABLE \"temporary_webhooks\" RENAME TO \"webhooks\"",
    "CREATE INDEX \"IDX_webhooks_sessionId\" ON \"webhooks\" (\"sessionId\") ",
    "DROP INDEX \"IDX_ingress_events_dispatchState\"",
    "DROP INDEX \"IDX_ingress_events_createdAt\"",
    "DROP INDEX \"UQ_ingress_events_instance_delivery\"",
    "CREATE TABLE \"temporary_ingress_events\" (\"id\" varchar PRIMARY KEY NOT NULL, \"instanceId\" varchar NOT NULL, \"pluginId\" varchar NOT NULL, \"providerDeliveryId\" varchar NOT NULL, \"route\" varchar NOT NULL, \"payload\" text, \"payloadHash\" varchar, \"sessionId\" varchar, \"dispatchState\" varchar, \"dispatchAttempts\" integer NOT NULL DEFAULT (0), \"lastDispatchAt\" datetime, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')))",
    "INSERT INTO \"temporary_ingress_events\"(\"id\", \"instanceId\", \"pluginId\", \"providerDeliveryId\", \"route\", \"payload\", \"payloadHash\", \"sessionId\", \"dispatchState\", \"dispatchAttempts\", \"lastDispatchAt\", \"createdAt\") SELECT \"id\", \"instanceId\", \"pluginId\", \"providerDeliveryId\", \"route\", \"payload\", \"payloadHash\", \"sessionId\", \"dispatchState\", \"dispatchAttempts\", \"lastDispatchAt\", \"createdAt\" FROM \"ingress_events\"",
    "DROP TABLE \"ingress_events\"",
    "ALTER TABLE \"temporary_ingress_events\" RENAME TO \"ingress_events\"",
    "CREATE INDEX \"IDX_ingress_events_dispatchState\" ON \"ingress_events\" (\"dispatchState\", \"createdAt\") ",
    "CREATE INDEX \"IDX_ingress_events_createdAt\" ON \"ingress_events\" (\"createdAt\") ",
    "CREATE UNIQUE INDEX \"UQ_ingress_events_instance_delivery\" ON \"ingress_events\" (\"pluginId\", \"instanceId\", \"providerDeliveryId\") ",
    "CREATE TABLE \"temporary_sessions\" (\"id\" varchar PRIMARY KEY NOT NULL, \"name\" varchar(100) NOT NULL, \"status\" varchar(50) NOT NULL DEFAULT ('created'), \"phone\" varchar(20), \"pushName\" varchar(100), \"config\" text NOT NULL DEFAULT ('{}'), \"proxyUrl\" varchar(255), \"proxyType\" varchar(10), \"connectedAt\" text, \"lastActiveAt\" text, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')), \"nodeId\" varchar(190), \"claimedAt\" text, \"leaseExpiresAt\" text, \"nodeUrl\" varchar(2048), CONSTRAINT \"UQ_ac984ccbd8b01af155e1874e8cb\" UNIQUE (\"name\"))",
    "INSERT INTO \"temporary_sessions\"(\"id\", \"name\", \"status\", \"phone\", \"pushName\", \"config\", \"proxyUrl\", \"proxyType\", \"connectedAt\", \"lastActiveAt\", \"createdAt\", \"updatedAt\", \"nodeId\", \"claimedAt\", \"leaseExpiresAt\", \"nodeUrl\") SELECT \"id\", \"name\", \"status\", \"phone\", \"pushName\", \"config\", \"proxyUrl\", \"proxyType\", \"connectedAt\", \"lastActiveAt\", \"createdAt\", \"updatedAt\", \"nodeId\", \"claimedAt\", \"leaseExpiresAt\", \"nodeUrl\" FROM \"sessions\"",
    "DROP TABLE \"sessions\"",
    "ALTER TABLE \"temporary_sessions\" RENAME TO \"sessions\"",
    "DROP INDEX \"IDX_webhooks_sessionId\"",
    "CREATE TABLE \"temporary_webhooks\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"url\" varchar(2048) NOT NULL, \"events\" text NOT NULL DEFAULT ('[\"message.received\"]'), \"secret\" varchar(255), \"headers\" text NOT NULL DEFAULT ('{}'), \"active\" boolean NOT NULL DEFAULT (1), \"retryCount\" integer NOT NULL DEFAULT (3), \"lastTriggeredAt\" text, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')), \"filters\" text, CONSTRAINT \"FK_d209715bb62b12255e825580af6\" FOREIGN KEY (\"sessionId\") REFERENCES \"sessions\" (\"id\") ON DELETE CASCADE ON UPDATE NO ACTION)",
    "INSERT INTO \"temporary_webhooks\"(\"id\", \"sessionId\", \"url\", \"events\", \"secret\", \"headers\", \"active\", \"retryCount\", \"lastTriggeredAt\", \"createdAt\", \"updatedAt\", \"filters\") SELECT \"id\", \"sessionId\", \"url\", \"events\", \"secret\", \"headers\", \"active\", \"retryCount\", \"lastTriggeredAt\", \"createdAt\", \"updatedAt\", \"filters\" FROM \"webhooks\"",
    "DROP TABLE \"webhooks\"",
    "ALTER TABLE \"temporary_webhooks\" RENAME TO \"webhooks\"",
    "CREATE INDEX \"IDX_webhooks_sessionId\" ON \"webhooks\" (\"sessionId\") ",
    "CREATE TABLE \"temporary_message_batches\" (\"id\" varchar PRIMARY KEY NOT NULL, \"batch_id\" varchar NOT NULL, \"session_id\" varchar NOT NULL, \"status\" varchar NOT NULL DEFAULT ('pending'), \"messages\" text NOT NULL, \"options\" text, \"progress\" text, \"results\" text, \"current_index\" integer NOT NULL DEFAULT (0), \"created_at\" datetime NOT NULL DEFAULT (datetime('now')), \"updated_at\" datetime NOT NULL DEFAULT (datetime('now')), \"started_at\" text, \"completed_at\" text, CONSTRAINT \"UQ_message_batches_session_id_batch_id\" UNIQUE (\"session_id\", \"batch_id\"))",
    "INSERT INTO \"temporary_message_batches\"(\"id\", \"batch_id\", \"session_id\", \"status\", \"messages\", \"options\", \"progress\", \"results\", \"current_index\", \"created_at\", \"updated_at\", \"started_at\", \"completed_at\") SELECT \"id\", \"batch_id\", \"session_id\", \"status\", \"messages\", \"options\", \"progress\", \"results\", \"current_index\", \"created_at\", \"updated_at\", \"started_at\", \"completed_at\" FROM \"message_batches\"",
    "DROP TABLE \"message_batches\"",
    "ALTER TABLE \"temporary_message_batches\" RENAME TO \"message_batches\"",
    "DROP INDEX \"IDX_ingress_events_dispatchState\"",
    "DROP INDEX \"IDX_ingress_events_createdAt\"",
    "DROP INDEX \"UQ_ingress_events_instance_delivery\"",
    "CREATE TABLE \"temporary_ingress_events\" (\"id\" varchar PRIMARY KEY NOT NULL, \"instanceId\" varchar NOT NULL, \"pluginId\" varchar NOT NULL, \"providerDeliveryId\" varchar NOT NULL, \"route\" varchar NOT NULL, \"payload\" text, \"payloadHash\" varchar, \"sessionId\" varchar, \"dispatchState\" varchar, \"dispatchAttempts\" integer NOT NULL DEFAULT (0), \"lastDispatchAt\" text, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')))",
    "INSERT INTO \"temporary_ingress_events\"(\"id\", \"instanceId\", \"pluginId\", \"providerDeliveryId\", \"route\", \"payload\", \"payloadHash\", \"sessionId\", \"dispatchState\", \"dispatchAttempts\", \"lastDispatchAt\", \"createdAt\") SELECT \"id\", \"instanceId\", \"pluginId\", \"providerDeliveryId\", \"route\", \"payload\", \"payloadHash\", \"sessionId\", \"dispatchState\", \"dispatchAttempts\", \"lastDispatchAt\", \"createdAt\" FROM \"ingress_events\"",
    "DROP TABLE \"ingress_events\"",
    "ALTER TABLE \"temporary_ingress_events\" RENAME TO \"ingress_events\"",
    "CREATE INDEX \"IDX_ingress_events_dispatchState\" ON \"ingress_events\" (\"dispatchState\", \"createdAt\") ",
    "CREATE INDEX \"IDX_ingress_events_createdAt\" ON \"ingress_events\" (\"createdAt\") ",
    "CREATE UNIQUE INDEX \"UQ_ingress_events_instance_delivery\" ON \"ingress_events\" (\"pluginId\", \"instanceId\", \"providerDeliveryId\") ",
    "CREATE INDEX \"IDX_ae44b476c522450bd395615a7c\" ON \"baileys_stored_messages\" (\"sessionId\", \"createdAt\") ",
    "CREATE UNIQUE INDEX \"IDX_1bb396e881628cd4dc8f0d2a8b\" ON \"baileys_stored_messages\" (\"sessionId\", \"waMessageId\") ",
    "CREATE INDEX \"IDX_1e39479a7a8aa37eab08df013b\" ON \"lid_mappings\" (\"phone\") ",
    "CREATE INDEX \"IDX_951ec734b350580529e0b7ab2d\" ON \"status_updates\" (\"expiresAt\") ",
    "CREATE UNIQUE INDEX \"IDX_1152eee4d077ae74396d73c1fb\" ON \"status_updates\" (\"sessionId\", \"waStatusId\") ",
    "CREATE INDEX \"IDX_432ae5ea12bbda479dcae30fb1\" ON \"status_updates\" (\"sessionId\", \"contactJid\") ",
    "DROP INDEX \"IDX_ae44b476c522450bd395615a7c\"",
    "DROP INDEX \"IDX_1bb396e881628cd4dc8f0d2a8b\"",
    "CREATE TABLE \"temporary_baileys_stored_messages\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"waMessageId\" varchar NOT NULL, \"serializedMessage\" text NOT NULL, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT \"FK_55c1dfd945d2c552a5313b25460\" FOREIGN KEY (\"sessionId\") REFERENCES \"sessions\" (\"id\") ON DELETE CASCADE ON UPDATE NO ACTION)",
    "INSERT INTO \"temporary_baileys_stored_messages\"(\"id\", \"sessionId\", \"waMessageId\", \"serializedMessage\", \"createdAt\") SELECT \"id\", \"sessionId\", \"waMessageId\", \"serializedMessage\", \"createdAt\" FROM \"baileys_stored_messages\"",
    "DROP TABLE \"baileys_stored_messages\"",
    "ALTER TABLE \"temporary_baileys_stored_messages\" RENAME TO \"baileys_stored_messages\"",
    "CREATE INDEX \"IDX_ae44b476c522450bd395615a7c\" ON \"baileys_stored_messages\" (\"sessionId\", \"createdAt\") ",
    "CREATE UNIQUE INDEX \"IDX_1bb396e881628cd4dc8f0d2a8b\" ON \"baileys_stored_messages\" (\"sessionId\", \"waMessageId\") ",
    "DROP INDEX \"IDX_templates_session_name\"",
    "CREATE TABLE \"temporary_templates\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"name\" varchar(100) NOT NULL, \"body\" text NOT NULL, \"header\" text, \"footer\" text, \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT \"FK_53208331c90e332d3f13780729c\" FOREIGN KEY (\"sessionId\") REFERENCES \"sessions\" (\"id\") ON DELETE CASCADE ON UPDATE NO ACTION)",
    "INSERT INTO \"temporary_templates\"(\"id\", \"sessionId\", \"name\", \"body\", \"header\", \"footer\", \"createdAt\", \"updatedAt\") SELECT \"id\", \"sessionId\", \"name\", \"body\", \"header\", \"footer\", \"createdAt\", \"updatedAt\" FROM \"templates\"",
    "DROP TABLE \"templates\"",
    "ALTER TABLE \"temporary_templates\" RENAME TO \"templates\"",
    "CREATE UNIQUE INDEX \"IDX_templates_session_name\" ON \"templates\" (\"sessionId\", \"name\") ",
    "DROP INDEX \"IDX_automation_rules_sessionId\"",
    "CREATE TABLE \"temporary_automation_rules\" (\"id\" varchar PRIMARY KEY NOT NULL, \"sessionId\" varchar NOT NULL, \"name\" varchar(100) NOT NULL, \"enabled\" boolean NOT NULL DEFAULT (1), \"conditions\" text, \"replyText\" text NOT NULL, \"cooldownSeconds\" integer NOT NULL DEFAULT (60), \"createdAt\" datetime NOT NULL DEFAULT (datetime('now')), \"updatedAt\" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT \"FK_0a1a8f3af56b4861c39161daf4d\" FOREIGN KEY (\"sessionId\") REFERENCES \"sessions\" (\"id\") ON DELETE CASCADE ON UPDATE NO ACTION)",
    "INSERT INTO \"temporary_automation_rules\"(\"id\", \"sessionId\", \"name\", \"enabled\", \"conditions\", \"replyText\", \"cooldownSeconds\", \"createdAt\", \"updatedAt\") SELECT \"id\", \"sessionId\", \"name\", \"enabled\", \"conditions\", \"replyText\", \"cooldownSeconds\", \"createdAt\", \"updatedAt\" FROM \"automation_rules\"",
    "DROP TABLE \"automation_rules\"",
    "ALTER TABLE \"temporary_automation_rules\" RENAME TO \"automation_rules\"",
    "CREATE INDEX \"IDX_automation_rules_sessionId\" ON \"automation_rules\" (\"sessionId\") "
  ],
  "main": [
    "DROP INDEX \"IDX_api_keys_keyHash\"",
    "DROP INDEX \"IDX_audit_logs_createdAt\"",
    "DROP INDEX \"IDX_audit_logs_sessionId\"",
    "DROP INDEX \"IDX_audit_logs_apiKeyId\"",
    "DROP INDEX \"IDX_audit_logs_action\"",
    "CREATE UNIQUE INDEX \"IDX_df3b25181df0b4b59bd93f16e1\" ON \"api_keys\" (\"keyHash\") ",
    "CREATE INDEX \"IDX_cee5459245f652b75eb2759b4c\" ON \"audit_logs\" (\"action\") ",
    "CREATE INDEX \"IDX_741fa976d1e04e695f3aa23cb8\" ON \"audit_logs\" (\"apiKeyId\") ",
    "CREATE INDEX \"IDX_dd2b6e43c767b6b5b2bb227ace\" ON \"audit_logs\" (\"sessionId\") ",
    "CREATE INDEX \"IDX_c69efb19bf127c97e6740ad530\" ON \"audit_logs\" (\"createdAt\") "
  ]
}
