Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run Migrations "No migration defined" error... #21

Closed
g33kidd opened this issue Aug 19, 2017 · 3 comments
Closed

Can't run Migrations "No migration defined" error... #21

g33kidd opened this issue Aug 19, 2017 · 3 comments
Assignees

Comments

@g33kidd
Copy link

g33kidd commented Aug 19, 2017

➔ crystal sam.cr -- generate:migration create_test
Error in sam.cr:4: expanding macro

load_dependencies "jennifer"
^~~~~~~~~~~~~~~~~

in sam.cr:4: expanding macro

load_dependencies "jennifer"
^

in macro 'load_dependencies' /Users/g33kidd/Sandbox/PRL/crival/lib/sam/src/sam.cr:75, line 2:

   1.
>  2.     require "jennifer/sam"
   3.

while requiring "jennifer/sam"
in lib/jennifer/src/jennifer/sam.cr:1: instantiating 'Sam:Module#namespace(String)'

Sam.namespace "db" do
    ^~~~~~~~~

in lib/jennifer/src/jennifer/sam.cr:1: instantiating 'Sam:Module#namespace(String)'

Sam.namespace "db" do
    ^~~~~~~~~

in lib/jennifer/src/jennifer/sam.cr:4: instantiating 'Jennifer::Migration::Runner:Module#migrate()'

    Jennifer::Migration::Runner.migrate
                                ^~~~~~~

in lib/jennifer/src/jennifer/migration/runner.cr:46: instantiating 'migrate(Int32)'

        migrate(-1)
        ^~~~~~~

in lib/jennifer/src/jennifer/migration/runner.cr:7: No migration defined

        return if ::Jennifer::Migration::Base.migrations.empty?

Not really sure what's going on here. I have the database and configuration setup properly (i think.)

@g33kidd
Copy link
Author

g33kidd commented Aug 19, 2017

I wasn't requiring my .database.yml correctly. After I did that it worked properly. Maybe a TODO for better errors?

@imdrasil imdrasil self-assigned this Aug 19, 2017
@Xosmond
Copy link

Xosmond commented Aug 27, 2017

@g33kidd Could you please show how you solve it?. I'm experiencing the same problem.

require "jennifer/adapter/postgres" # for postgres
require "jennifer"

Jennifer::Config.configure do |conf|
  conf.host = "localhost"
  conf.user = "user"
  conf.password = "pass"
  conf.adapter = "pg"
  conf.db = "mig_db"
  conf.migration_files_path = "./migrations"
end

Jennifer::Config.configure do |conf|
  conf.logger = Logger.new(STDOUT)

  conf.logger.formatter = Logger::Formatter.new do |severity, datetime, progname, message, io|
    io << datetime << ": " << message
  end
  conf.logger.level = Logger::DEBUG
end

This is my config file.

@imdrasil imdrasil added the Done label Sep 6, 2017
@imdrasil
Copy link
Owner

imdrasil commented Sep 6, 2017

@Xosmond this is fixed in v_0.3.4 branch and will be merged to master (with creating new release) on the 11th of September

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants