You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.8 KiB

from tortoise import BaseDBAsyncClient
async def upgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE `Paths` DROP INDEX `stop`;
ALTER TABLE `Paths` DROP INDEX `is_valididx`;
ALTER TABLE `Paths` DROP INDEX `is_activeidx`;
ALTER TABLE `Paths` DROP INDEX `start`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_charging`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_done`;
ALTER TABLE `Agvs` DROP INDEX `is_valididx`;
ALTER TABLE `Agvs` DROP INDEX `num`;
ALTER TABLE `Agvs` DROP INDEX `agvid`;
ALTER TABLE `Agvs` DROP INDEX `is_activeidx`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_abnormal`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_busy`;
CREATE INDEX `agvs_is_charging` ON `Agvs` (`is_charging`);
CREATE INDEX `is_valididx` ON `Agvs` (`is_valid`);
CREATE INDEX `agvs_is_busy` ON `Agvs` (`is_busy`);
CREATE INDEX `agvs_is_done` ON `Agvs` (`is_done`);
CREATE INDEX `agvid` ON `Agvs` (`agvid`);
CREATE INDEX `agvs_is_abnormal` ON `Agvs` (`is_abnormal`);
CREATE INDEX `is_activeidx` ON `Agvs` (`is_active`);
CREATE INDEX `num` ON `Agvs` (`num`);
CREATE INDEX `stop` ON `Paths` (`stop`);
CREATE INDEX `start` ON `Paths` (`start`);
CREATE INDEX `is_activeidx` ON `Paths` (`is_active`);
CREATE INDEX `is_valididx` ON `Paths` (`is_valid`);"""
async def downgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE `Paths` DROP INDEX `is_valididx`;
ALTER TABLE `Paths` DROP INDEX `is_activeidx`;
ALTER TABLE `Paths` DROP INDEX `start`;
ALTER TABLE `Paths` DROP INDEX `stop`;
ALTER TABLE `Agvs` DROP INDEX `num`;
ALTER TABLE `Agvs` DROP INDEX `is_activeidx`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_abnormal`;
ALTER TABLE `Agvs` DROP INDEX `agvid`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_done`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_busy`;
ALTER TABLE `Agvs` DROP INDEX `is_valididx`;
ALTER TABLE `Agvs` DROP INDEX `agvs_is_charging`;
CREATE INDEX `agvs_is_busy` ON `Agvs` (`is_busy`);
CREATE INDEX `agvs_is_abnormal` ON `Agvs` (`is_abnormal`);
CREATE INDEX `is_activeidx` ON `Agvs` (`is_active`);
CREATE INDEX `agvid` ON `Agvs` (`agvid`);
CREATE INDEX `num` ON `Agvs` (`num`);
CREATE INDEX `is_valididx` ON `Agvs` (`is_valid`);
CREATE INDEX `agvs_is_done` ON `Agvs` (`is_done`);
CREATE INDEX `agvs_is_charging` ON `Agvs` (`is_charging`);
CREATE INDEX `start` ON `Paths` (`start`);
CREATE INDEX `is_activeidx` ON `Paths` (`is_active`);
CREATE INDEX `is_valididx` ON `Paths` (`is_valid`);
CREATE INDEX `stop` ON `Paths` (`stop`);"""