Creating PG schema does not execute migration SQL
pisaacs opened this issue · 2 comments
Most of my migrations include execute SQL commands (e.g, 'ALTER SEQUENCE venues_id_seq RESTART 5000;'). The application successfully creates schemas under the primary Postgres database; however, after the schema is created, it appears not to include alters from my migration's 'execute <<-SQL' block.
Is this a limitation of the apartment gem?
The apartment gem does NOT execute migrations to create new tenants. Migrations should never be considered the source for the database structure. This is what the schema file is for. Unfortunately not everything can be represented in the Rails schema.rb
which is why people use the :sql format.
There's currently talks in another issue about supporting structure.sql, which presumably would support your custom sql, but for now using schema.rb this is not supported.
Thanks for sharing - that helps a lot.