Skip to content

Commit 313b084

Browse files
committed
fix(migration): Service account creator nullable if creator is deleted
1 parent fb4d9cb commit 313b084

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

github_hooks/db/migrate/20250718124232_create_service_accounts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def change
33
create_table :service_accounts, id: false do |t|
44
t.uuid :id, primary_key: true, null: false
55
t.string :description
6-
t.uuid :creator_id, null: false
6+
t.uuid :creator_id
77
end
88

99
add_foreign_key :service_accounts, :users, column: :id, on_delete: :cascade

guard/priv/front_repo/migrations/20250716010415_create_service_accounts.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ defmodule Guard.FrontRepo.Migrations.CreateServiceAccounts do
33

44
def change do
55
create table(:service_accounts, primary_key: false) do
6-
add :id, references(:users, type: :binary_id, on_delete: :delete_all),
6+
add :id, references(:users, type: :binary_id, on_delete: :delete_all),
77
primary_key: true, null: false
88
add :description, :string, size: 500
9-
add :creator_id, references(:users, type: :binary_id, on_delete: :nilify_all),
10-
null: false
9+
add :creator_id, references(:users, type: :binary_id, on_delete: :nilify_all)
1110
end
1211
end
13-
end
12+
end

0 commit comments

Comments
 (0)