Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defmodule Back.Repo.Migrations.ChangeVisualCascadeDeleteInPluginManager do
use Ecto.Migration

def up do
drop constraint(:plugin_manager, "plugin_manager_visual_fkey")

alter table(:plugin_manager) do
modify :visual, references(:visuals, on_delete: :delete_all, type: :binary_id)
end
end

def down do
drop constraint(:plugin_manager, "plugin_manager_visual_fkey")

alter table(:plugin_manager) do
modify :visual, references(:visuals, on_delete: :restrict, type: :binary_id)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
defmodule Back.Repo.Migrations.ChangePluginCascadeDeleteInPluginManager do
use Ecto.Migration

def up do
execute "ALTER TABLE plugin_manager DROP CONSTRAINT IF EXISTS plugin_manager_automaton_fkey"

execute """
ALTER TABLE plugin_manager
ADD CONSTRAINT plugin_manager_automaton_fkey
FOREIGN KEY (automaton)
REFERENCES automaton(automaton_id)
ON DELETE CASCADE
"""
end

def down do
execute "ALTER TABLE plugin_manager DROP CONSTRAINT IF EXISTS plugin_manager_automaton_fkey"

execute """
ALTER TABLE plugin_manager
ADD CONSTRAINT plugin_manager_automaton_fkey
FOREIGN KEY (automaton)
REFERENCES automaton(automaton_id)
ON DELETE NO ACTION
"""
end
end