Remove foreign key constraint from devices to sessions

Devices should persist independently of sessions - when a session is
deleted, the device registration should remain valid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-01-21 21:35:57 +01:00
parent 8a77fd7966
commit 2f9e41d356
2 changed files with 1 additions and 3 deletions
@@ -5,7 +5,7 @@ class CreateActionPushNativeDevices < ActiveRecord::Migration[8.0]
t.string :platform, null: false
t.string :token, null: false
t.belongs_to :owner, polymorphic: true, type: :uuid, index: false
t.belongs_to :session, type: :uuid, foreign_key: true
t.belongs_to :session, type: :uuid
t.timestamps
end
Generated
-2
View File
@@ -853,6 +853,4 @@ ActiveRecord::Schema[8.2].define(version: 2026_02_18_120000) do
t.index ["account_id"], name: "index_webhooks_on_account_id"
t.index ["board_id", "subscribed_actions"], name: "index_webhooks_on_board_id_and_subscribed_actions", length: { subscribed_actions: 255 }
end
add_foreign_key "action_push_native_devices", "sessions"
end