defmodule SimpleshopTheme.Repo.Migrations.AddFulfilmentFieldsToOrders do
  use Ecto.Migration

  def change do
    alter table(:orders) do
      add :fulfilment_status, :string, null: false, default: "unfulfilled"
      add :provider_order_id, :string
      add :provider_status, :string
      add :fulfilment_error, :string
      add :tracking_number, :string
      add :tracking_url, :string
      add :submitted_at, :utc_datetime
      add :shipped_at, :utc_datetime
      add :delivered_at, :utc_datetime
    end

    create index(:orders, [:fulfilment_status])
    create index(:orders, [:provider_order_id])
  end
end
