diff --git a/dictation_server/db/migrations/028-create_lisence_allocation_history.sql b/dictation_server/db/migrations/028-create_lisence_allocation_history.sql index ccacee8..4dea86c 100644 --- a/dictation_server/db/migrations/028-create_lisence_allocation_history.sql +++ b/dictation_server/db/migrations/028-create_lisence_allocation_history.sql @@ -1,9 +1,8 @@ -- +migrate Up -CREATE TABLE IF NOT EXISTS `license_allocation_history` ( - `id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT '割り当て履歴ID', - `user_id` BIGINT UNSIGNED NOT NULL COMMENT 'ユーザーID', +CREATE TABLE IF NOT EXISTS `lisence_allocation_history` ( + `user_id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT 'ユーザーID', `license_id` BIGINT UNSIGNED NOT NULL COMMENT 'ライセンスID', - `is_allocated` BOOLEAN NOT NULL DEFAULT 0 COMMENT '割り当て済みか', + `allocate_type` VARCHAR(255) NOT NULL COMMENT '割り当て種別(割当解除/割当)', `executed_at` TIMESTAMP NOT NULL COMMENT '実施日時', `switch_from_type` VARCHAR(255) NOT NULL COMMENT '切り替え元種別(特になし/カード/トライアル)', `deleted_at` TIMESTAMP COMMENT '削除時刻', @@ -14,4 +13,4 @@ CREATE TABLE IF NOT EXISTS `license_allocation_history` ( ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- +migrate Down -DROP TABLE `license_allocation_history`; \ No newline at end of file +DROP TABLE `lisence_allocation_history`; \ No newline at end of file diff --git a/dictation_server/db/migrations/029-create_license_allocation_history.sql b/dictation_server/db/migrations/029-create_license_allocation_history.sql new file mode 100644 index 0000000..8d30cfc --- /dev/null +++ b/dictation_server/db/migrations/029-create_license_allocation_history.sql @@ -0,0 +1,19 @@ +-- +migrate Up +DROP TABLE IF EXISTS `lisence_allocation_history`; + +CREATE TABLE IF NOT EXISTS `license_allocation_history` ( + `id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT '割り当て履歴ID', + `user_id` BIGINT UNSIGNED NOT NULL COMMENT 'ユーザーID', + `license_id` BIGINT UNSIGNED NOT NULL COMMENT 'ライセンスID', + `is_allocated` BOOLEAN NOT NULL DEFAULT 0 COMMENT '割り当て済みか', + `executed_at` TIMESTAMP NOT NULL COMMENT '実施日時', + `switch_from_type` VARCHAR(255) NOT NULL COMMENT '切り替え元種別(特になし/カード/トライアル)', + `deleted_at` TIMESTAMP COMMENT '削除時刻', + `created_by` VARCHAR(255) COMMENT '作成者', + `created_at` TIMESTAMP DEFAULT now() COMMENT '作成時刻', + `updated_by` VARCHAR(255) COMMENT '更新者', + `updated_at` TIMESTAMP DEFAULT now() COMMENT '更新時刻' +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- +migrate Down +DROP TABLE `license_allocation_history`; \ No newline at end of file