Skip to content

No existing migrations are applied - cannot rollback #8

@ksr-13

Description

@ksr-13

When running
bundle exec rake db:rollback
getting
No existing migrations are applied - cannot rollback

My Rakefile

base_config = {
  project_root: Dir.pwd,
  dbadapter: 'postgres',
  # dbname: 'liberty_bell_development',
  dbname: dbname,
  # username: 'postgres',
  username: username,
  # password: 'postgres',
  password: password,
  # default log_level is nil, in which mode the executed actions such as
  # starting/finishing a migration in a given direction or creating and
  # dropping the database are not logged to standard output.
  log_level: :info,

  # Default options:
  sql_log_level: :debug,
  dump_schema_on_migrate: false, # it's a good idea to enable it for the reference environment
  pg_dump: 'pg_dump', # command used to run pg_dump
  # pg_dump: 'psql', # command used to run psql when calling rake db:shell if adapter is postgres
  migrations_location: 'db/migrations',
  schema_location: 'db/migrations/schema.sql',
  seeds_location: 'db/seeds.rb',
  # for tasks such as creating the database:
  # when nil, defaults to the value of the :dbadapter config.
  # This is the database we should connect to before executing "create database dbname"
  # maintenancedb: :default,
  migrations_table: "schema_migrations",
  # allow other tables data to be included in the dump file generated by rake db:schema_dump
  # extra_tables_in_dump: nil
  # for example, if you want to keep migrations from ActiveRecord in the dump file, while using
  # another table for Sequel migrations:
  # migrations_table: 'sequel_schema_migrations',
  # extra_tables_in_dump: ['schema_migrations']
}

namespace 'db' do
  SequelTools.inject_rake_tasks base_config.merge(dump_schema_on_migrate: true), self
end

rake db:create db:migrate db:drop
all work.
Database has a table schema_migrations it shows
[{:version=>5}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions