-- Deploy gaia:2017_12_04_pv_punishment to mysql

BEGIN;

    ALTER TABLE `api_punishment` ADD COLUMN `target` varchar(20) DEFAULT 'all' NOT NULL;
    ALTER TABLE `api_punishment` ADD COLUMN `pv_limit` integer DEFAULT 0 NOT NULL;

    CREATE TABLE `api_pvpunishmentrecord` (
        `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
        `punishment_id` integer NOT NULL,
        `start_time` datetime(6) NOT NULL,
        `end_time` datetime(6) NOT NULL,
        `pv_limit` integer NOT NULL
    )
    ;
    ALTER TABLE `api_pvpunishmentrecord` ADD CONSTRAINT `punishment_id_refs_id_41d0460e` FOREIGN KEY (`punishment_id`) REFERENCES `api_punishment` (`id`);

COMMIT;
