-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add mysql8 compatible migrations
- Loading branch information
1 parent
1cf5c76
commit 413c39b
Showing
6 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
services/api/database/migrations/20241231000000_mysql8_compatibility.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = async function(knex) { | ||
return knex.schema | ||
.alterTable('advanced_task_definition', function (table) { | ||
table.specificType('description', 'text').notNullable().alter(); | ||
table.string('group_name', 300).alter(); | ||
table.specificType('command', 'text').alter(); | ||
}) | ||
.alterTable('environment_fact', function (table) { | ||
table.specificType('description', 'text').alter(); | ||
table.specificType('category', 'text').alter(); | ||
}) | ||
.alterTable('environment_problem', function (table) { | ||
table.string('identifier', 100).notNullable().alter(); | ||
table.string('lagoon_service', 100).defaultTo('').alter(); | ||
table.specificType('description', 'text').alter(); | ||
table.string('version', 100).defaultTo('').alter(); | ||
}) | ||
.alterTable('organization', function (table) { | ||
table.specificType('description', 'text').notNullable().alter(); | ||
}) | ||
.alterTable('project', function (table) { | ||
table.json('metadata').alter(); | ||
}) | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = async function(knex) { | ||
// caveats around this are that the rollback can only work while data is still saved in keycloak attributes | ||
// once we remove that duplication of attribute into keycloak, this rollback would result in data loss for group>project associations | ||
// for any group project associations made after the attribute removal | ||
return knex.schema | ||
.alterTable('advanced_task_definition', function (table) { | ||
table.specificType('description', 'text').defaultTo('').notNullable().alter(); | ||
table.string('group_name', 300).alter(); | ||
table.specificType('command', 'text').defaultTo('').alter(); | ||
}) | ||
.alterTable('environment_fact', function (table) { | ||
table.specificType('description', 'text').defaultTo('').alter(); | ||
table.specificType('category', 'text').defaultTo('').alter(); | ||
}) | ||
.alterTable('environment_problem', function (table) { | ||
table.string('identifier', 100).notNullable().alter(); | ||
table.string('lagoon_service', 100).defaultTo('').alter(); | ||
table.specificType('description', 'text').defaultTo('').alter(); | ||
table.string('version', 100).defaultTo('').alter(); | ||
}) | ||
.alterTable('organization', function (table) { | ||
table.specificType('description', 'text').notNullable().defaultTo('').alter(); | ||
}) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters