765 B · text History e569b6d
defmodule CartosnapApp.Repo.Migrations.CreatePhotoPhotos do
  use Ecto.Migration

  def change do
    create table(:photo_photos, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :name, :string
      add :exif, :map
      add :filename, :string
      add :date, :utc_datetime
      add :url_original, :string
      add :url_full, :string
      add :url_preview, :string
      add :url_thumb, :string
      add :blurhash, :string
      add :geo_point, :geometry
      add :promoted, :boolean, default: false, null: false
      add :user, references(:users, on_delete: :nothing, type: :binary_id)

      timestamps()
    end

    create index(:photo_photos, [:user])
    create index(:photo_photos, [:geo_point], using: "GiST")
  end
end