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>
This commit is contained in:
Rosa Gutierrez
2026-01-22 13:01:21 +01:00
parent 1b53396050
commit 34fd62faf1
9 changed files with 24 additions and 31 deletions
+3 -3
View File
@@ -127,8 +127,8 @@ GEM
specs: specs:
action_text-trix (2.1.16) action_text-trix (2.1.16)
railties railties
addressable (2.8.7) addressable (2.8.8)
public_suffix (>= 2.0.2, < 7.0) public_suffix (>= 2.0.2, < 8.0)
ast (2.4.3) ast (2.4.3)
autotuner (1.1.0) autotuner (1.1.0)
aws-eventstream (1.4.0) aws-eventstream (1.4.0)
@@ -337,7 +337,7 @@ GEM
psych (5.3.1) psych (5.3.1)
date date
stringio stringio
public_suffix (6.0.2) public_suffix (7.0.2)
puma (7.2.0) puma (7.2.0)
nio4r (~> 2.0) nio4r (~> 2.0)
raabro (1.4.0) raabro (1.4.0)
+1 -1
View File
@@ -12,7 +12,7 @@ gem "console1984", bc: "console1984"
gem "audits1984", bc: "audits1984", branch: "flavorjones/coworker-api" gem "audits1984", bc: "audits1984", branch: "flavorjones/coworker-api"
# Native push notifications (iOS/Android) # Native push notifications (iOS/Android)
gem "action_push_native", github: "rails/action_push_native" gem "action_push_native", github: "rails/action_push_native", branch: "add-abstract-record"
# Telemetry # Telemetry
gem "rails_structured_logging", bc: "rails-structured-logging" gem "rails_structured_logging", bc: "rails-structured-logging"
+2 -1
View File
@@ -62,7 +62,8 @@ GIT
GIT GIT
remote: https://github.com/rails/action_push_native.git remote: https://github.com/rails/action_push_native.git
revision: 9fb4a2bfe54270b1a3508028f00aaa586e257655 revision: 8ef7023a335e1f09ad1fe22a4b7b007b040528bd
branch: add-abstract-record
specs: specs:
action_push_native (0.3.0) action_push_native (0.3.0)
activejob (>= 8.0) activejob (>= 8.0)
Generated
-13
View File
@@ -69,19 +69,6 @@ ActiveRecord::Schema[8.2].define(version: 2026_02_18_120000) do
t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true
end end
create_table "action_push_native_devices", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "name"
t.uuid "owner_id"
t.string "owner_type"
t.string "platform", null: false
t.uuid "session_id"
t.string "token", null: false
t.datetime "updated_at", null: false
t.index ["owner_type", "owner_id", "token"], name: "idx_on_owner_type_owner_id_token_95a4008c64", unique: true
t.index ["session_id"], name: "index_action_push_native_devices_on_session_id"
end
create_table "action_text_rich_texts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| create_table "action_text_rich_texts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.uuid "account_id", null: false t.uuid "account_id", null: false
t.text "body", size: :long t.text "body", size: :long
-13
View File
@@ -69,19 +69,6 @@ ActiveRecord::Schema[8.2].define(version: 2026_02_18_120000) do
t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true
end end
create_table "action_push_native_devices", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "name", limit: 255
t.integer "owner_id"
t.string "owner_type", limit: 255
t.string "platform", limit: 255, null: false
t.string "token", limit: 255, null: false
t.datetime "updated_at", null: false
t.string "uuid", limit: 255, null: false
t.index ["owner_type", "owner_id", "uuid"], name: "idx_on_owner_type_owner_id_uuid_a42e3920d5", unique: true
t.index ["owner_type", "owner_id"], name: "index_action_push_native_devices_on_owner"
end
create_table "action_text_rich_texts", id: :uuid, force: :cascade do |t| create_table "action_text_rich_texts", id: :uuid, force: :cascade do |t|
t.uuid "account_id", null: false t.uuid "account_id", null: false
t.text "body", limit: 4294967295 t.text "body", limit: 4294967295
+13
View File
@@ -53,6 +53,19 @@ ActiveRecord::Schema[8.2].define(version: 2026_01_26_230838) do
t.index ["token_digest"], name: "index_audits1984_auditor_tokens_on_token_digest", unique: true t.index ["token_digest"], name: "index_audits1984_auditor_tokens_on_token_digest", unique: true
end end
create_table "action_push_native_devices", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "name"
t.uuid "owner_id"
t.string "owner_type"
t.string "platform", null: false
t.uuid "session_id"
t.string "token", null: false
t.datetime "updated_at", null: false
t.index ["owner_type", "owner_id", "token"], name: "idx_on_owner_type_owner_id_token_95a4008c64", unique: true
t.index ["session_id"], name: "index_action_push_native_devices_on_session_id"
end
create_table "audits1984_audits", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| create_table "audits1984_audits", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.uuid "auditor_id", null: false t.uuid "auditor_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
+5
View File
@@ -10,6 +10,11 @@ module Fizzy
# moved from config/initializers/queenbee.rb # moved from config/initializers/queenbee.rb
Queenbee.host_app = Fizzy Queenbee.host_app = Fizzy
# Configure ActionPushNative to use the saas database
ActiveSupport.on_load(:action_push_native_record) do
connects_to database: { writing: :saas, reading: :saas }
end
initializer "fizzy_saas.content_security_policy", before: :load_config_initializers do |app| initializer "fizzy_saas.content_security_policy", before: :load_config_initializers do |app|
app.config.x.content_security_policy.form_action = "https://checkout.stripe.com https://billing.stripe.com" app.config.x.content_security_policy.form_action = "https://checkout.stripe.com https://billing.stripe.com"
end end