From 2f9e41d356432cd9e326189d4384153a3b1ded77 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Wed, 21 Jan 2026 21:35:57 +0100 Subject: [PATCH] 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 --- db/migrate/20260114203313_create_action_push_native_devices.rb | 2 +- db/schema.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/db/migrate/20260114203313_create_action_push_native_devices.rb b/db/migrate/20260114203313_create_action_push_native_devices.rb index 4985c8636..c696a35bc 100644 --- a/db/migrate/20260114203313_create_action_push_native_devices.rb +++ b/db/migrate/20260114203313_create_action_push_native_devices.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 1b562554d..19ee667a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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