-- Deploy gaia:api_2017_10_11_add_tables_doctor_finance_province_city to mysql

BEGIN;

-- XXX Add DDLs here.

CREATE TABLE `api_finance_province` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(50) NOT NULL
)
;
CREATE TABLE `api_finance_city` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(50) NOT NULL,
    `province_id` integer NOT NULL
)
;
ALTER TABLE `api_finance_city` ADD CONSTRAINT `province_id_refs_id_f9733f41` FOREIGN KEY (`province_id`) REFERENCES `api_finance_province` (`id`);


ALTER TABLE `api_doctoraccount` ADD COLUMN `city_finance_id` INT NULL;

ALTER TABLE `api_doctoraccount` ADD CONSTRAINT `city_id_refs_id_f9733f41` FOREIGN KEY (`city_finance_id`) REFERENCES `api_finance_city` (`id`);


COMMIT;
