diff --git a/dictation_server/db/migrations/008-create_licenses.sql b/dictation_server/db/migrations/008-create_licenses.sql new file mode 100644 index 0000000..be359c3 --- /dev/null +++ b/dictation_server/db/migrations/008-create_licenses.sql @@ -0,0 +1,15 @@ +-- +migrate Up +CREATE TABLE IF NOT EXISTS `licenses` ( + `id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT 'ライセンスID', + `expiry_date` TIMESTAMP COMMENT '有効期限', + `account_id` BIGINT UNSIGNED NOT NULL COMMENT '所有アカウントID', + `type` VARCHAR(255) NOT NULL COMMENT 'ライセンス種別(トライアル/通常/カード)', + `status` VARCHAR(255) NOT NULL COMMENT 'ライセンス状態(未割当/割り当て済/削除済)', + `allocated_user_id` BIGINT UNSIGNED COMMENT '割り当てユーザID', + `order_id` BIGINT UNSIGNED COMMENT '注文ID', + `deleted_at` TIMESTAMP COMMENT '削除日時', + `delete_order_id` BIGINT UNSIGNED COMMENT '削除注文ID' +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- +migrate Down +DROP TABLE `licenses`; \ No newline at end of file diff --git a/dictation_server/db/migrations/009-create_licenses_history.sql b/dictation_server/db/migrations/009-create_licenses_history.sql new file mode 100644 index 0000000..b74c6b6 --- /dev/null +++ b/dictation_server/db/migrations/009-create_licenses_history.sql @@ -0,0 +1,12 @@ +-- +migrate Up +CREATE TABLE IF NOT EXISTS `licenses_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', + `allocated` BOOLEAN NOT NULL COMMENT '割り当てたか', + `executed_at` TIMESTAMP NOT NULL COMMENT '実施日時', + `exchange_type` VARCHAR(255) NOT NULL COMMENT 'ライセンス切り替え種別(なし/トライアル→通常/紙→通常)' +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- +migrate Down +DROP TABLE `licenses_history`; \ No newline at end of file