Migration
Usage
defmodule ReactPhoenix.Repo.Migrations.ChangeGid do
use Ecto.Migration
def change do
alter table(:users) do
add :address, :string
add :usertype_id, references(:usertypes, on_delete: :nothing)
add :event_id, references(:usertypes, on_delete: :delete_all, type: :string)
add :my_array, {:array, inner_type}
modify :title, :text
remove :views
end
#rename is outside alter statement
rename table(:subevents), :parent, to: :event_id
#order matters, if another column depends should remove before dropping
drop table(:registration_question_options)
end
endOn delete
UUID or Nanoid
Advanced Autogenerate Nanoid
More Example File
Last updated