Skip to content

rails db:migrate only works in development mode #3

@kohheepeace

Description

@kohheepeace

Issue

By default in rails,

commands like rails db:create or rails db:migrate are supposed to work in both devlopment and test environments,

but It doesn't work that way on gitpod.

# this create only development database in gitpod
rails db:create

# we need to set RAILS_ENV=test
rails db:create RAILS_ENV=test

Current Possible Causes

This is supposed to be caused because gitpod sets ENV["DATABASE_URL"].

(*In the local development, ENV["DATABASE_URL"] is nil. This is why both development and test migrates are executed correctly at local).

https://github.com/rails/rails/pull/39027/files

Solutions for this issue

I have not yet found a solution for this. I can't set or unset ENV["DATABASE_URL"] on gitpod.

Discussion about current behavior

I want to run rails db:migrate for both development and test environment, but there seems to be a lot of support for current behavior.

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