Skip to content

Commit

Permalink
fix(api): remove dmId and userId in dm_messages migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Irere123 committed Aug 10, 2024
1 parent f82df0d commit cdaf13e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions api/priv/repo/migrations/20240810104114_dms_prod.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule Telescope.Repo.Migrations.DmsProd do
use Ecto.Migration

def change do
drop_if_exists(constraint(:dm_messages, "dm_messages_user_id_fkey"))
drop_if_exists(constraint(:dm_messages, "dm_messages_lodge_id_fkey"))

alter table(:dm_messages) do
remove_if_exists(:dmId, :uuid)
remove_if_exists(:userId, :uuid)

add_if_not_exists(:user_id, references(:users, on_delete: :delete_all, type: :uuid),
null: false
)

add_if_not_exists(:lodge_id, references(:lodges, on_delete: :delete_all, type: :uuid),
null: false
)
end

execute("drop table if exists dm_users;", "")
end
end

0 comments on commit cdaf13e

Please sign in to comment.