<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
      xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:pro="http://www.liquibase.org/xml/ns/pro"
      xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd
      http://www.liquibase.org/xml/ns/pro
      http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd">

   <changeSet author="tchamberlain" id="initial-1">
      <sql>
         DROP TABLE IF EXISTS person;
         CREATE TABLE person
         (
            id INT AUTO_INCREMENT primary key ,
            create_date TIMESTAMP DEFAULT now(),
            modify_date TIMESTAMP DEFAULT now(),

            first_name VARCHAR(80) NOT NULL,
            last_name VARCHAR(80) NOT NULL,
            birth_date DATE,
            email VARCHAR(250) NOT NULL,
            is_employed BOOLEAN,
            annual_salary DECIMAL(12,2),
            days_worked INTEGER
         );
         INSERT INTO person (id, first_name, last_name, birth_date, email, is_employed, annual_salary, days_worked) VALUES (1, 'Darin', 'Kelkhoff', '1980-05-31', 'darin.kelkhoff@gmail.com', 1, 25000, 27);
         INSERT INTO person (id, first_name, last_name, birth_date, email, is_employed, annual_salary, days_worked) VALUES (2, 'James', 'Maes', '1980-05-15', 'jmaes@mmltholdings.com', 1, 26000, 124);
         INSERT INTO person (id, first_name, last_name, birth_date, email, is_employed, annual_salary, days_worked) VALUES (3, 'Tim', 'Chamberlain', '1976-05-28', 'tchamberlain@mmltholdings.com', 0, null, 0);
         INSERT INTO person (id, first_name, last_name, birth_date, email, is_employed, annual_salary, days_worked) VALUES (4, 'Tyler', 'Samples', NULL, 'tsamples@mmltholdings.com', 1, 30000, 99);
         INSERT INTO person (id, first_name, last_name, birth_date, email, is_employed, annual_salary, days_worked) VALUES (5, 'Garret', 'Richardson', '1981-01-01', 'grichardson@mmltholdings.com', 1, 1000000, 232);


         DROP TABLE IF EXISTS carrier;
         CREATE TABLE carrier
         (
            id INT AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(80) NOT NULL,
            company_code VARCHAR(80) NOT NULL,
            service_level VARCHAR(80) NOT NULL
         );
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (1, 'UPS Ground', 'UPS', 'G');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (2, 'UPS 2Day', 'UPS', '2');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (3, 'UPS International', 'UPS', 'I');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (4, 'Fedex Ground', 'FEDEX', 'G');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (5, 'Fedex Next Day', 'UPS', '1');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (6, 'Will Call', 'WILL_CALL', 'W');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (7, 'USPS Priority', 'USPS', '1');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (8, 'USPS Super Slow', 'USPS', '4');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (9, 'USPS Super Fast', 'USPS', '0');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (10, 'DHL International', 'DHL', 'I');
         INSERT INTO carrier (id, name, company_code, service_level) VALUES (11, 'GSO', 'GSO', 'G');


         DROP TABLE IF EXISTS child_table;
         CREATE TABLE child_table
         (
            id INT AUTO_INCREMENT primary key,
            name VARCHAR(80) NOT NULL
         );
         INSERT INTO child_table (id, name) VALUES (1, 'Timmy');
         INSERT INTO child_table (id, name) VALUES (2, 'Jimmy');
         INSERT INTO child_table (id, name) VALUES (3, 'Johnny');
         INSERT INTO child_table (id, name) VALUES (4, 'Gracie');
         INSERT INTO child_table (id, name) VALUES (5, 'Suzie');


         DROP TABLE IF EXISTS parent_table;
         CREATE TABLE parent_table
         (
            id INT AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(80) NOT NULL,
            child_id INT,
            foreign key (child_id) references child_table(id)
         );
         INSERT INTO parent_table (id, name, child_id) VALUES (1, 'Tim''s Dad', 1);
         INSERT INTO parent_table (id, name, child_id) VALUES (2, 'Tim''s Mom', 1);
         INSERT INTO parent_table (id, name, child_id) VALUES (3, 'Childless Man', null);
         INSERT INTO parent_table (id, name, child_id) VALUES (4, 'Childless Woman', null);
         INSERT INTO parent_table (id, name, child_id) VALUES (5, 'Johny''s Single Dad', 3);


         DROP TABLE IF EXISTS city;
         CREATE TABLE city
         (
            id INT AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(80) NOT NULL,
            state VARCHAR(2) NOT NULL
         );
         INSERT INTO city (id, name, state) VALUES (1, 'Decatur', 'IL');
         INSERT INTO city (id, name, state) VALUES (2, 'Chester', 'IL');
         INSERT INTO city (id, name, state) VALUES (3, 'St. Louis', 'MO');
         INSERT INTO city (id, name, state) VALUES (4, 'Baltimore', 'MD');
         INSERT INTO city (id, name, state) VALUES (5, 'New York', 'NY');

      </sql>
   </changeSet>

</databaseChangeLog>
