-- +goose Up
-- Prepare staging tables for legacy ICAO dump import.

CREATE TABLE IF NOT EXISTS icao_old_import (
  id int(11) NOT NULL,
  code varchar(150) NOT NULL,
  address varchar(255) DEFAULT NULL,
  phone varchar(50) DEFAULT NULL,
  mobile varchar(50) DEFAULT NULL,
  email varchar(50) DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

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

-- +goose Down
DROP TABLE IF EXISTS icao_old_id_map;
DROP TABLE IF EXISTS icao_old_import;
