-- Deploy gaia:create_table_platform_user to mysql

BEGIN;

CREATE TABLE `api_platformuser` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `is_deleted` bool NOT NULL,
    `is_bind` bool NOT NULL,
    `platform_type` smallint NOT NULL,
    `platform_id` varchar(180) NOT NULL,
    `extra_info` longtext NOT NULL
)
;
ALTER TABLE `api_platformuser` ADD CONSTRAINT `user_id_refs_id_ef07957b` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

alter table `api_platformuser` add unique index `user_activity_id`(`platform_id`, `platform_type`);

COMMIT;
