salix/db/versions/.archive/10258-azureOak/00-firstScript.sql

22 lines
900 B
SQL

-- Place your SQL code here
USE vn;
ALTER TABLE vn.vehicleEvent DROP FOREIGN KEY vehicleEvent_FK;
ALTER TABLE vn.vehicleState MODIFY COLUMN id int(11) NOT NULL;
ALTER TABLE vn.vehicleState DROP PRIMARY KEY;
ALTER TABLE vn.vehicleState ADD CONSTRAINT vehicleState_PK PRIMARY KEY (id);
ALTER TABLE vn.vehicleState MODIFY COLUMN id int(11) auto_increment NOT NULL;
ALTER TABLE vn.vehicleState ADD hasToNotify INT DEFAULT NULL NULL;
ALTER TABLE vn.vehicleEvent ADD CONSTRAINT vehicleEvent_FK FOREIGN KEY (vehicleStateFk) REFERENCES vn.vehicleState(id);
ALTER TABLE vn.vehicleEvent ADD notified DATETIME NULL;
CREATE OR REPLACE TABLE vn.vehicleConfig (
eventEarlyDays int NULL
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.vehicleConfig MODIFY COLUMN eventEarlyDays int(11) DEFAULT 15 COMMENT 'Previous days on which the expiration of an event must be notified';