Skip to content

Question / Request: A run-time indicator that squashing is in progress #83

@jasonkarns

Description

@jasonkarns

When using squasher in conjunction with rails-erd, we get errors.

Context

rails-erd typically hooks into rake db:migrate to automatically generate a graphical ERD representing the schema. It does this by booting the Rails app, navigating all the models, and building up a tree of the table relationships, which it then prints.

Squasher works by running the migrations to a point, and then dumping the schema at that point into an "init" migration. However, the point in the migrations where Squasher pauses (given as the argument to its CLI), means the database only has tables and schema representing that point in time. But the app codebase, still has models from "the present", which surely conflict with that schema.

Problem

The result is that booting the rails app with latest app code, against an older database structure will fail. And because rails-erd does this "automatically" after db:migrate tasks, means that the task fails before squasher is able to write the init and clean migrations. (Thus blocking squasher from working)

Proposal

I propose a flag of some kind (be it an environment variable, constant, or attribute on Squasher) that can be interrogated within a Rake task. That way the rake tasks can know when squashing is in progress and to disable any hooks like rails-erd.

Request

This may be something that's already available for introspection. So perhaps this is just a request to document it as such and make it part of the public API?

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