-- +goose Up

ALTER TABLE bases
  ADD COLUMN IF NOT EXISTS latitude DECIMAL(10,7) NOT NULL DEFAULT 0 AFTER address,
  ADD COLUMN IF NOT EXISTS longitude DECIMAL(10,7) NOT NULL DEFAULT 0 AFTER latitude;

ALTER TABLE base_operational_shift_times
  ADD COLUMN IF NOT EXISTS start_time_type VARCHAR(16) NOT NULL DEFAULT 'FIXED' AFTER date_end,
  ADD COLUMN IF NOT EXISTS end_time_type VARCHAR(16) NOT NULL DEFAULT 'FIXED' AFTER start_time_type;

ALTER TABLE missions
  ADD COLUMN IF NOT EXISTS start_time TIME NULL AFTER note,
  ADD COLUMN IF NOT EXISTS end_time TIME NULL AFTER start_time;

ALTER TABLE missions
  MODIFY COLUMN start_time TIME NULL,
  MODIFY COLUMN end_time TIME NULL;

-- +goose Down

ALTER TABLE missions
  DROP COLUMN IF EXISTS end_time,
  DROP COLUMN IF EXISTS start_time;

ALTER TABLE base_operational_shift_times
  DROP COLUMN IF EXISTS end_time_type,
  DROP COLUMN IF EXISTS start_time_type;

ALTER TABLE bases
  DROP COLUMN IF EXISTS longitude,
  DROP COLUMN IF EXISTS latitude;
