Skip to content

Production database can be easily accidentally dropped and recreated #53059

@mikepayready

Description

@mikepayready

Steps to reproduce

  • Generate a new Rails application
  • Connect the Rails application to a non-Rails database with an existing structure and data (specifically without a schema_migrations table)
  • Generate a schema.rb file for it
  • Launch the application as a docker container against a copy of the database without the Rails schema_migrations table (but with data)

Expected behavior

The data in the database will be preserved.

Actual behavior

This line in the generated docker-entrypoint will ultimately call this line from the Rake task because the schema migrations table is missing. This will then drop and recreate the database, losing all data in the existing database.

System configuration

Rails version: 7.2.1

Ruby version: 3.2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions