-- +goose Up
-- Prepare staging tables for legacy `bases` import.

CREATE TABLE IF NOT EXISTS bases_old_import (
  id int(11) NOT NULL,
  name varchar(50) NOT NULL,
  code varchar(10) NOT NULL,
  icao varchar(255) DEFAULT NULL,
  address varchar(255) DEFAULT NULL,
  phone varchar(50) DEFAULT NULL,
  mobile varchar(50) DEFAULT NULL,
  email varchar(50) DEFAULT NULL,
  rescue_emails varchar(255) DEFAULT NULL,
  doctor_emails varchar(255) DEFAULT NULL,
  sms_alert int(11) NOT NULL DEFAULT 1,
  check_list tinyint(1) DEFAULT 0,
  dry tinyint(1) DEFAULT 0,
  control_center tinyint(1) DEFAULT 0,
  service_transfer_list tinyint(1) DEFAULT 0,
  visible tinyint(1) DEFAULT 0,
  position tinyint(4) NOT NULL,
  type varchar(255) NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS base_old_id_map (
  old_id int(11) NOT NULL,
  new_id binary(16) NOT NULL,
  PRIMARY KEY (old_id),
  UNIQUE KEY uq_base_old_id_map_new_id (new_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- +goose Down
DROP TABLE IF EXISTS base_old_id_map;
DROP TABLE IF EXISTS bases_old_import;
