-- +goose Up
-- Create places table

CREATE TABLE IF NOT EXISTS places (
  id BINARY(16) NOT NULL PRIMARY KEY,
  state VARCHAR(255) NULL,
  post_code VARCHAR(32) NULL,
  location VARCHAR(255) NOT NULL,
  street VARCHAR(255) NULL,
  no VARCHAR(50) NULL,
  country_code VARCHAR(10) NULL,
  country_name VARCHAR(255) NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  created_by BINARY(16) NULL,
  updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  updated_by BINARY(16) NULL,
  deleted_at DATETIME NULL,
  deleted_by BINARY(16) NULL,

  KEY idx_places_location (location),
  KEY idx_places_state (state),
  KEY idx_places_post_code (post_code),
  KEY idx_places_country_code (country_code),
  KEY idx_places_deleted_at (deleted_at)
);

-- +goose Down
DROP TABLE IF EXISTS places;
