-- +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`;