schema dumper will drop ceate_views
Closed this issue · 13 comments
how to use rails default ActiveRecord::SchemaDumper instead of this gem I need to watch custom functions ,
add this gem to Gemfile AND run rails db:migrate
`
create_function :trans_to, sql_definition: <<-SQL
...
SQL
create_view "receivable_statistics", sql_definition: <<-SQL
..
SQL
`
all function are gone in schema.rb
how to recover schema
Are you using this with another GEM? I was thinking about adding a new config for this, but the class uses super
to maintain compatibility. Can you give me more information, like the gems that you are using?
Are you using this with another GEM? I was thinking about adding a new config for this, but the class uses
super
to maintain compatibility. Can you give me more information, like the gems that you are using?
i use scenic manage views and fx manage functions
gem 'scenic'
gem 'fx', github: "mirahtech/fx", branch: "feature/aggregates"
I guess it's conflict with https://github.com/scenic-views/scenic/blob/main/lib/scenic/schema_dumper.rb
Scenic
is supported by this gem, but FX is not. I'll add support to it. Are you using Rails 5 or 6?
rails 5
Can you give it a try with master_v1 branch?
well done! all_views rollback, but custom create_aggreates still missed which I guess defined in
create_aggreate
https://github.com/mirahtech/fx/blob/feature/aggregates/lib/fx/statements/aggregate.rb
dumper
Just pushed another commit. Let me know if works and I can push the new version
rails aborted!
NameError: undefined local variable or method `stream' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper:0x00007fce4603bda0>
/Users/liyongbo/.rvm/gems/ruby-2.6.3/bundler/gems/torque-postgresql-03591aa54298/lib/torque/postgresql/schema_dumper.rb:85:in `table_extensions'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/bundler/gems/torque-postgresql-03591aa54298/lib/torque/postgresql/schema_dumper.rb:59:in `tables'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/schema_dumper.rb:38:in `dump'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/bundler/gems/torque-postgresql-03591aa54298/lib/torque/postgresql/schema_dumper.rb:9:in `dump'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/schema_dumper.rb:22:in `dump'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:251:in `block (4 levels) in <top (required)>'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:250:in `open'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:250:in `block (3 levels) in <top (required)>'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:68:in `block (2 levels) in <top (required)>'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:61:in `block (2 levels) in <top (required)>'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/railties-5.2.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/railties-5.2.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/railties-5.2.2.1/lib/rails/command.rb:48:in `invoke'
/Users/liyongbo/.rvm/gems/ruby-2.6.3/gems/railties-5.2.2.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:schema:dump
(See full trace by running task with --trace)
My bad. I added a new method to better organize such compatibility related methods and I forgot to send forward the stream
. You can pull and try again.
Please, ensure to be using:
torque-postgresql 1.1.7 from https://github.com/crashtech/torque-postgresql.git (at master_v1@496f8bb)
Please, ensure to be using:
torque-postgresql 1.1.7 from https://github.com/crashtech/torque-postgresql.git (at master_v1@496f8bb)
thans, problem solved
Great!