Skip to content

Commit

Permalink
ifix
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed Jan 18, 2024
1 parent 6ecd0c3 commit 732e642
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/support/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

connects_to database: { writing: :primary, reading: :primary }
end

class SecondDatabaseRecord < ActiveRecord::Base
self.abstract_class = true

establish_connection :secondary
connects_to database: { writing: :secondary, reading: :secondary }
end

ActiveRecord::Schema.define(version: 0) do
Expand Down Expand Up @@ -151,6 +153,7 @@ class SecondDatabaseRecord < ActiveRecord::Base
add_foreign_key(:tag_hierarchies, :tags, column: 'descendant_id', on_delete: :cascade)
end

SecondDatabaseRecord.establish_connection
SecondDatabaseRecord.connection_pool.with_connection do |connection|
ActiveRecord::Schema.define(version: 0) do
connection.create_table 'menu_items', force: :cascade do |t|
Expand Down

0 comments on commit 732e642

Please sign in to comment.