-- liquibase formatted sql
-- changeset enson:create_do_pick_order_line_table

CREATE TABLE `do_pick_order_line` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `do_pick_order_id` INT NOT NULL,
  `pick_order_id` INT NULL,
  `do_order_id` INT NOT NULL,
  `pick_order_code` varchar(50) NULL,
  `delivery_order_code` varchar(50) NULL,
  `created` datetime NULL,
  `createdBy` varchar(30) NULL,
  `version` int DEFAULT 0,
  `modified` datetime NULL,
  `modifiedBy` varchar(30) NULL,
  `deleted` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_do_pick_order_id` (`do_pick_order_id`),
  KEY `idx_do_order_id` (`do_order_id`),
  KEY `idx_pick_order_id` (`pick_order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `do_pick_order_line_record` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `do_pick_order_id` INT NOT NULL,   
  `pick_order_id` INT NULL,
  `do_order_id` INT NOT NULL,
  `pick_order_code` varchar(50) NULL,
  `delivery_order_code` varchar(50) NULL,
  `created` datetime NULL,
  `createdBy` varchar(30) NULL,
  `version` int DEFAULT 0,
  `modified` datetime NULL,
  `modifiedBy` varchar(30) NULL,
  `deleted` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_do_pick_order_id` (`do_pick_order_id`),
  KEY `idx_do_order_id` (`do_order_id`),
  KEY `idx_pick_order_id` (`pick_order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;