berrypod/priv/repo/migrations/20260214004900_create_shipping_rates.exs

31 lines
940 B
Elixir
Raw Normal View History

defmodule SimpleshopTheme.Repo.Migrations.CreateShippingRates do
use Ecto.Migration
def change do
create table(:shipping_rates, primary_key: false) do
add :id, :binary_id, primary_key: true
add :provider_connection_id,
references(:provider_connections, type: :binary_id, on_delete: :delete_all),
null: false
add :blueprint_id, :integer, null: false
add :print_provider_id, :integer, null: false
add :country_code, :string, null: false
add :first_item_cost, :integer, null: false
add :additional_item_cost, :integer, null: false
add :currency, :string, null: false, default: "USD"
add :handling_time_days, :integer
timestamps(type: :utc_datetime)
end
create unique_index(:shipping_rates, [
:provider_connection_id,
:blueprint_id,
:print_provider_id,
:country_code
])
end
end