uptime-kuma/db/knex_migrations
2026-01-13 01:23:06 +00:00
..
2023-08-16-0000-create-uptime.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-08-18-0301-heartbeat.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-09-29-0000-heartbeat-retires.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-10-08-0000-mqtt-query.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-10-11-1915-push-token-to-32.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-10-16-0000-create-remote-browsers.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-12-20-0000-alter-status-page.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-12-21-0000-stat-ping-min-max.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2023-12-22-0000-hourly-uptime.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-01-22-0000-stats-extras.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-04-26-0000-snmp-monitor.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-08-24-000-add-cache-bust.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-08-24-0000-conditions.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-10-31-0000-fix-snmp-monitor.js fix not setting a default for json monitor operations (#5295) 2024-11-05 20:35:42 +08:00
2024-10-1315-rabbitmq-monitor.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2024-11-27-1927-fix-info-json-data-type.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-01-01-0000-add-smtp.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-02-15-2312-add-wstest.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-02-17-2142-generalize-analytics.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-03-04-0000-ping-advanced-options.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-03-25-0127-fix-5721.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-05-09-0000-add-custom-url.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-06-03-0000-add-ip-family.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-06-11-0000-add-manual-monitor.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-06-13-0000-maintenance-add-last-start.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-06-15-0001-manual-monitor-fix.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-06-24-0000-add-audience-to-oauth.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-07-17-0000-mqtt-websocket-path.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-09-02-0000-add-domain-expiry.js fix(mysql): fix domain_expiry migration for MySQL 8.0 compatibility (#6612) 2026-01-06 21:41:04 +01:00
2025-10-14-0000-add-ip-family-fix.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-10-15-0000-stat-table-fix.js Fix: Set default value for ping column to 0 in stat tables (#6188) 2025-10-16 07:30:26 +08:00
2025-10-15-0001-add-monitor-response-config.js chore: preemptivly reduce the cost to store the responses by lowering the limit and changing the on disk compression format (#6691) 2026-01-13 01:23:06 +00:00
2025-10-15-0002-add-response-to-heartbeat.js feat: Add configurable response data storage for notifications (#6684) 2026-01-12 18:39:12 +01:00
2025-10-24-0000-show-only-last-heartbeat.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-12-09-0000-add-system-service-monitor.js Added db migration file 2025-12-15 17:53:39 +01:00
2025-12-22-0121-optimize-important-indexes.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2025-12-29-0000-remove-line-notify.js Add migration to drop legacy LINE Notify configs 2025-12-29 12:29:55 +07:00
2026-01-02-0551-dns-last-result-to-text.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2026-01-02-0713-gamedig-v4-to-v5.js chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00
2026-01-05-0000-add-rss-title.js Update db/knex_migrations/2026-01-05-0000-add-rss-title.js 2026-01-06 00:15:54 -05:00
2026-01-05-0000-add-tls-monitor.js feat: add TLS monitor type for mTLS endpoint monitoring 2026-01-06 20:27:15 +02:00
2026-01-06-0000-fix-domain-expiry-column-type.js fix(mysql): fix domain_expiry migration for MySQL 8.0 compatibility (#6612) 2026-01-06 21:41:04 +01:00
2026-01-10-0000-convert-float-precision.js fix: Ensure ping can handle pings larger than 24 days by changing INT to BIGINT and FLOAT(8,2) to FLOAT(20,2) (#6668) 2026-01-11 12:48:00 +00:00
2026-01-15-0000-add-json-query-retry-only-status-code.js feat: Add option to retry only on status code failure for JSON Query monitors (#5693) (#6687) 2026-01-12 16:49:43 +01:00
README.md chore: enable formatting over the entire codebase in CI (#6655) 2026-01-09 02:10:36 +01:00

Info

https://knexjs.org/guide/migrations.html#knexfile-in-other-languages

Basic rules

  • All tables must have a primary key named id
  • Filename format: YYYY-MM-DD-HHMM-patch-name.js
  • Avoid native SQL syntax, use knex methods, because Uptime Kuma supports SQLite and MariaDB.

Template

exports.up = function (knex) {};

exports.down = function (knex) {};

// exports.config = { transaction: false };

Example

Filename: 2023-06-30-1348-create-user-and-product.js

exports.up = function (knex) {
  return knex.schema
    .createTable("user", function (table) {
      table.increments("id");
      table.string("first_name", 255).notNullable();
      table.string("last_name", 255).notNullable();
    })
    .createTable("product", function (table) {
      table.increments("id");
      table.decimal("price").notNullable();
      table.string("name", 1000).notNullable();
    })
    .then(() => {
      knex("products").insert([
        { price: 10, name: "Apple" },
        { price: 20, name: "Orange" },
      ]);
    });
};

exports.down = function (knex) {
  return knex.schema.dropTable("product").dropTable("user");
};

https://knexjs.org/guide/migrations.html#transactions-in-migrations