Closed mri-dula closed 6 years ago
Fixed this by changing the schema_search_path
in my database.yml
development:
adapter: postgresql
encoding: unicode
database: myapp
pool: 5
username: postgres
password: ***
host: localhost
schema_search_path: 'internal'
curious. thank you for investigating and providing a solution ⭐️
Steps to reproduce
1) Add the apartment gem to your rails app and change the default schema to
internal
inapartment.rb
2) Add a new migrationrails g migration SomeNewMigration
. Add some schema changes in the new migration. Like adding a new table. 3) Runrails db:migrate
4) Start the Rails Server and browse to any route in the app (http://somedomain.lvh.me/something).Expected behavior
The
schema_migrations
table in theinternal
and any other tenant schemas must have the new migration no. inserted. Theschema_migrations
table of thepublic
schema must be ignored. The app should work fine.Actual behavior
The
schema_migrations
table in theinternal
and any other tenant schemas do have the new migration no. inserted. However, upon browsing the app, I get theActiveRecord::PendingMigrationError
. If I insert the new migration no. into thepublic.schema_migrations
table, it works.System configuration
OS: Mac OS High Sierra
Database: Postgresql 9.6
Apartment version: 1.2.0
Apartment config (in
config/initializers/apartment.rb
or so):Rails (or ActiveRecord) version: 5.0.6
Ruby version: 2.4.1p111