Open Michoels opened 3 months ago
Workaround for now is to manually edit schema.rb
after every migration 😬.
I also need to manually inject the statement for creating the DB schema, like so:
# schema.rb
ActiveRecord::Schema[7.0].define(version: ****) do
ActiveRecord::Base.connection.exec_query <<-SQL
CREATE SCHEMA external
SQL
# Schema statements continue here...
end
This is necessary because schema.rb
does not support raw SQL.
We'll need to continue manually adding it until the problems in structure.sql
are resolved.
Bumping this
Issue
I have a Rails app which uses tables that are spread across several schemas. The main tables are in
dbo
, but some tables are inexternal
,sales
, etc. We mostly use the schemas for access control.I've been creating tables in other schemas like so:
The tables are correctly created. However, they are not properly represented in
schema.rb
(I can't usestructure.sql
because there are too many bugs)Expected behavior
I would expect
schema.rb
to properly represent the schema-specific table like so:Actual behavior
Instead, it strips the schema from the table name:
This breaks the entire approach of using separate schemas.
How to reproduce
This unit test reproduces the issue.
Details
7.0.8
7.0.5.1
2.1.7
1.4.6
Output of
tsql -C