[DEV] correct migration

This commit is contained in:
Edouard DUPIN 2023-11-26 22:51:53 +01:00
parent 2ba8d21bde
commit a78c3f5c1f
2 changed files with 45 additions and 30 deletions

View File

@ -8,7 +8,7 @@ public class Migration20231126 extends MigrationSqlStep {
@Override
public String getName() {
return "reorder the migration for the new API of archidata";
return "migration-2023-11-26: reorder the migration for the new API of archidata";
}
public Migration20231126() {
@ -17,6 +17,21 @@ public class Migration20231126 extends MigrationSqlStep {
@Override
public void generateStep() throws Exception {
// update migration update (last one)
addAction("""
ALTER TABLE `KAR_migration`
CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST,
CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`,
CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`,
CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`,
ADD `version` int NOT NULL DEFAULT '2' AFTER `deleted`,
CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL COMMENT 'Name of the migration' AFTER `version`,
CHANGE `terminated` `terminated` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'if the migration is well terminated or not' AFTER `name`,
CHANGE `stepId` `stepId` int NULL COMMENT 'index in the migration progression' AFTER `terminated`,
CHANGE `count` `count` int NULL COMMENT 'number of element in the migration' AFTER `stepId`,
CHANGE `log` `log` text COLLATE 'utf8mb3_general_ci' NULL COMMENT 'Log generate by the migration' AFTER `count`;
""");
addAction("""
ALTER TABLE `application`
CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST,
@ -38,9 +53,9 @@ public class Migration20231126 extends MigrationSqlStep {
CHANGE `updatedAt` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`,
CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`,
CHANGE `parentId` `parentId` bigint NOT NULL AFTER `deleted`,
CHANGE `name` `name` varchar(255) COLLATE 'utf8mb3_general_ci' NOT NULL AFTER `parentId`,
CHANGE `name` `name` text COLLATE 'utf8mb3_general_ci' NOT NULL AFTER `parentId`,
CHANGE `endValidityTime` `endValidityTime` timestamp(3) NOT NULL AFTER `name`,
CHANGE `token` `token` varchar(255) COLLATE 'utf8mb3_general_ci' NOT NULL AFTER `endValidityTime`;
CHANGE `token` `token` text COLLATE 'utf8mb3_general_ci' NOT NULL AFTER `endValidityTime`;
""");
addAction("""
@ -78,7 +93,7 @@ public class Migration20231126 extends MigrationSqlStep {
CHANGE `key` `key` varchar(512) COLLATE 'utf8mb4_0900_ai_ci' NOT NULL AFTER `deleted`,
CHANGE `right` `right` varchar(6) COLLATE 'utf8mb4_0900_ai_ci' NOT NULL DEFAULT 'rw----' COMMENT 'Right for the specific element(ADMIN [rw] USER [rw] other [rw])' AFTER `key`,
CHANGE `type` `type` varchar(10) COLLATE 'utf8mb4_0900_ai_ci' NOT NULL COMMENT 'Type Of the data' AFTER `right`,
CHANGE `value` `value` varchar(255) COLLATE 'utf8mb3_general_ci' NOT NULL COMMENT 'Value of the configuration' AFTER `type`;
CHANGE `value` `value` text COLLATE 'utf8mb3_general_ci' NOT NULL COMMENT 'Value of the configuration' AFTER `type`;
""");
addAction("""