standalone-migrations icon indicating copy to clipboard operation
standalone-migrations copied to clipboard

v 7.1.0 | NoMethodError: undefined method `schema_file' for primary:Module

Open drizzle-mizzle opened this issue 2 years ago • 2 comments

rake db:*any_command* fails with error:

DEPRECATION WARNING: ActiveRecord::Base.schema_format is deprecated and will be removed in Rails 7.1
Use `ActiveRecord.schema_format` instead.
 (called from <top (required)> at /Users/__/__/Rakefile:9)
rake aborted!
NoMethodError: undefined method `schema_file' for primary:Module
Did you mean?  schema_file_type
/Users/__/__/Rakefile:9:in `<top (required)>'
/Users/__/.rvm/rubies/ruby-3.0.1/bin/ruby_executable_hooks:22:in `eval'
/Users/__/.rvm/rubies/ruby-3.0.1/bin/ruby_executable_hooks:22:in `<main>'
(See full trace by running task with --trace)

Couldn't find any solution but to switch back on 6.1 gem "standalone_migrations", "~> 6.1"

drizzle-mizzle avatar Mar 18 '22 07:03 drizzle-mizzle

Rakefile:

# frozen_string_literal: true

require 'standalone_migrations'

ENV["RACK_ENV"] ||= "development"

Rake.add_rakelib("rakelib/**")

StandaloneMigrations::Tasks.load_tasks  <-- Rakefile:9:in `<top (required)>' points here

drizzle-mizzle avatar Mar 18 '22 08:03 drizzle-mizzle

Yep, this is the issue I mentioned in #167

jaredcwhite avatar Mar 21 '22 02:03 jaredcwhite

Workaround: Until a fix is provided, I have the environment variable SCHEMA set to 'db/schema.rb' and it works for me.

pmatsinopoulos avatar Nov 02 '22 17:11 pmatsinopoulos

So set -x SCHEMA 'db/schema.rb'. I want to reduce manual effort and potential for errors with others though.

So I used this instead: gem 'standalone_migrations', git: 'https://github.com/vovka/standalone-migrations'

Seems the hyphen worked for the main gem version, but to use an unregistered alternate, it would only recognize the underscored name, and this project, apart from mlrazz's, had less errors, or required less manual effort to utilize.

Pysis868 avatar Mar 31 '23 19:03 Pysis868

This is still an issue. Is there a longer term solution other than adding an ENV?

hlascelles avatar Jun 09 '23 14:06 hlascelles

I think this can be closed now #171 has been merged

owst avatar Nov 03 '23 09:11 owst

osaka wow

drizzle-mizzle avatar Nov 04 '23 07:11 drizzle-mizzle