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