-- +migrate Up
CREATE TABLE IF NOT EXISTS `users` (
	`id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT 'ID',
	`external_id` VARCHAR(255) NOT NULL COMMENT '外部ユーザーID',
	`account_id` BIGINT UNSIGNED COMMENT 'アカウントID',
	`role` VARCHAR(255) NOT NULL COMMENT '役職',
	`author_id` VARCHAR(255) COMMENT 'AuthorID',
	`accepted_terms_version` 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 '更新時刻',
	UNIQUE author_id_index (author_id, account_id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;

-- +migrate Down
DROP TABLE `users`;