-- Deploy gaia:api_create_table_sign_status to mysql

BEGIN;

CREATE TABLE `api_sign_user_status` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `activity_id` integer NOT NULL,
    `is_remind` bool NOT NULL,
    `has_window` bool NOT NULL,
    `add_sign_number` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_sign_user_status` ADD CONSTRAINT `activity_id_refs_id_343a4dbb` FOREIGN KEY (`activity_id`) REFERENCES `api_sign_activity` (`id`);
ALTER TABLE `api_sign_user_status` ADD CONSTRAINT `user_id_refs_id_e423c54f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
CREATE TABLE `api_newest_sign` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `activity_id` integer NOT NULL,
    `newest_time` date,
    `days_count` integer NOT NULL,
    `available_days` integer NOT NULL,
    `share_code` varchar(18),
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_newest_sign` ADD CONSTRAINT `activity_id_refs_id_36646476` FOREIGN KEY (`activity_id`) REFERENCES `api_sign_activity` (`id`);
ALTER TABLE `api_newest_sign` ADD CONSTRAINT `user_id_refs_id_75c7c41c` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);


COMMIT;
