defmodule Tololo.Repo.Migrations.DeliveriesOnDelete do
  @moduledoc """
  Updates resources based on their most recent snapshots.

  This file was autogenerated with `mix ash_postgres.generate_migrations`
  """

  use Ecto.Migration

  def up do
    drop constraint(:delivery_state_changes, "delivery_state_changes_delivery_id_fkey")

    alter table(:delivery_state_changes) do
      modify :delivery_id,
             references(:deliveries,
               column: :id,
               name: "delivery_state_changes_delivery_id_fkey",
               type: :uuid,
               prefix: "public",
               on_delete: :delete_all
             )
    end
  end

  def down do
    drop constraint(:delivery_state_changes, "delivery_state_changes_delivery_id_fkey")

    alter table(:delivery_state_changes) do
      modify :delivery_id,
             references(:deliveries,
               column: :id,
               name: "delivery_state_changes_delivery_id_fkey",
               type: :uuid,
               prefix: "public"
             )
    end
  end
end
