Files
fizzy/saas/db/migrate/20260114203313_create_action_push_native_devices.rb
Rosa Gutierrez 34fd62faf1 Move devices table to saas database
Use ActionPushNative's new on_load hook to configure the database connection,
following the same pattern as Active Storage and Action Text:

  ActiveSupport.on_load(:action_push_native_record) do
    connects_to database: { writing: :saas, reading: :saas }
  end

This allows ApplicationPushDevice to inherit directly from ActionPushNative::Device
without needing an intermediate abstract class.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00

16 lines
470 B
Ruby

class CreateActionPushNativeDevices < ActiveRecord::Migration[8.0]
def change
create_table :action_push_native_devices do |t|
t.string :name
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
t.timestamps
end
add_index :action_push_native_devices, [ :owner_type, :owner_id, :token ], unique: true
end
end