Skip to content

db:create task fails if routes touch the database #36841

@artm

Description

@artm

We are using devise's devise_for in routes which accesses the database.

When setting up CI environment rake db:create fails because it loads the environment, which includes routes, which fails trying to access the database.

Steps to reproduce

  1. create a new project
  2. add to routes.rb:

ActiveRecord::Base.connection.table_exists? :users

  1. rake db:create

Expected behavior

A database is created

Actual behavior

Rake fails with "database doesn't exist"

System configuration

Rails version: 5.2.x

Ruby version: doesn't matter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions