@@ -10,8 +10,8 @@ defmodule Eventos.Repo.Migrations.AlterEventTimestampsToDateTimeWithTimeZone do
|
||||
|
||||
def down do
|
||||
alter table("events") do
|
||||
modify :inserted_at, :naive_datetime
|
||||
modify :updated_at, :naive_datetime
|
||||
modify :inserted_at, :timestamptz
|
||||
modify :updated_at, :timestamptz
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
defmodule :"Elixir.Eventos.Repo.Migrations.Add-user-confirm-email-fields" do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table(:users) do
|
||||
add :confirmed_at, :utc_datetime
|
||||
add :confirmation_sent_at, :utc_datetime
|
||||
add :confirmation_token, :string
|
||||
end
|
||||
create unique_index(:users, [:confirmation_token], name: "index_unique_users_confirmation_token")
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:users) do
|
||||
remove :confirmed_at
|
||||
remove :confirmation_sent_at
|
||||
remove :confirmation_token
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
defmodule :"Elixir.Eventos.Repo.Migrations.Add-user-password-reset-fields" do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table(:users) do
|
||||
add :reset_password_sent_at, :utc_datetime
|
||||
add :reset_password_token, :string
|
||||
end
|
||||
create unique_index(:users, [:reset_password_token], name: "index_unique_users_reset_password_token")
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:users) do
|
||||
remove :reset_password_sent_at
|
||||
remove :reset_password_token
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
defmodule Eventos.Repo.Migrations.AlterEventTimestampsToDateTimeWithTimeZone do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table("events") do
|
||||
modify :inserted_at, :timestamptz
|
||||
modify :updated_at, :timestamptz
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table("events") do
|
||||
modify :inserted_at, :utc_datetime
|
||||
modify :updated_at, :utc_datetime
|
||||
end
|
||||
end
|
||||
end
|
||||
31
priv/repo/migrations/20180702150922_add_address_type.exs
Normal file
31
priv/repo/migrations/20180702150922_add_address_type.exs
Normal file
@@ -0,0 +1,31 @@
|
||||
defmodule Eventos.Repo.Migrations.AddAddressType do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
AddressTypeEnum.create_type
|
||||
alter table(:events) do
|
||||
add :address_type, :address_type
|
||||
add :online_address, :string
|
||||
add :phone, :string
|
||||
end
|
||||
drop constraint(:events, "events_address_id_fkey")
|
||||
rename table(:events), :address_id, to: :physical_address_id
|
||||
alter table(:events) do
|
||||
modify :physical_address_id, references(:addresses, on_delete: :nothing)
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:events) do
|
||||
remove :address_type
|
||||
remove :online_address
|
||||
remove :phone
|
||||
end
|
||||
AddressTypeEnum.drop_type
|
||||
drop constraint(:events, "events_physical_address_id_fkey")
|
||||
rename table(:events), :physical_address_id, to: :address_id
|
||||
alter table(:events) do
|
||||
modify :address_id, references(:addresses, on_delete: :nothing)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
defmodule Eventos.Repo.Migrations.RemoveSlugForEvent do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table(:events) do
|
||||
remove(:slug)
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:events) do
|
||||
add :slug, :string, null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user