Skip to content

Commit 873dd5c

Browse files
Restore migration changes (undo previous revert)
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
1 parent b49c5aa commit 873dd5c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

db/knex_migrations/2025-09-02-0000-add-domain-expiry.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ exports.up = function (knex) {
66
.createTable("domain_expiry", (table) => {
77
table.increments("id");
88
table.datetime("last_check");
9-
table.text("domain").unique().notNullable();
9+
// Use VARCHAR(255) for MySQL/MariaDB compatibility with unique constraint
10+
// Maximum domain name length is 253 characters (255 octets on the wire)
11+
table.string("domain", 255).unique().notNullable();
1012
table.datetime("expiry");
1113
table.integer("last_expiry_notification_sent").defaultTo(null);
1214
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Ensure domain column is VARCHAR(255) across all database types.
2+
// This migration ensures MySQL, SQLite, and MariaDB have consistent column type,
3+
// even if a user installed 2.1.0-beta.0 or 2.1.0-beta.1 which had TEXT type for this column.
4+
// Maximum domain name length is 253 characters (255 octets on the wire).
5+
// Note: The unique constraint is already present from the original migration.
6+
exports.up = function (knex) {
7+
return knex.schema.alterTable("domain_expiry", function (table) {
8+
table.string("domain", 255).notNullable().alter();
9+
});
10+
};
11+
12+
exports.down = function (knex) {
13+
// No rollback needed - keeping VARCHAR(255) is the correct state
14+
};

0 commit comments

Comments
 (0)