hasura / hasura/graphql-engine

Generate down migration for "updated_at" column template

Open
#8,018 1 comment 0 reactions 0 assignees View on GitHub
c/console estimate/M k/enhancement p/longterm
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

The "frequently used columns" wizard when modifying a table is very helpful, but the "updated_at" template does not generate a down migration. Migrations really need to be able to be applied up and down, so not doing that creates a bad situation.

### Describe the solution you'd like

Since the Hasura console is the one generating the code to add the column, set up a function, and creating a trigger to call that function, it should know enough on how to undo that work. It's currently being pushed to the end user, who didn't create the DDL for "up" migration, making the user a poor choice for implementing the "down" migration correctly.

### Describe alternatives you've considered

I have to manually supply down migrations wherever I've used that "updated_at" template.

### If the feature is approved, would you be willing to submit a PR?

Yes.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Hasura console's "frequently used columns" wizard and the "updated_at" column template. Compare the generated up migration with other templates and trace the column, function, and trigger setup. Done means the template also generates a working down migration that reverses its changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.