hasura / hasura/graphql-engine
Auto-generate a down migration for 'CREATE OR REPLACE FUNCTION'
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
`down.sql` AS-IS:
```sql
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- CREATE OR REPLACE FUNCTION attempt_is_answered(attempt_row attempts) RETURNS BOOLEAN AS $$
-- BEGIN
-- RETURN COALESCE(attempt_row.answer_boolean, attempt_row.answer_integer, attempt_row.answer_text, attempt_row.answer_date);
-- END;
-- $$ LANGUAGE plpgsql STABLE;
```
### Describe the solution you'd like
`down.sql` TO-BE:
```sql
DROP FUNCTION IF EXISTS ;
```
### Describe alternatives you've considered
—
Contributor guide
Research direction
Start by tracing the migration generation entry point that handles CREATE OR REPLACE FUNCTION statements. Check how the current generator emits the placeholder in down.sql, then verify that the completed behavior emits DROP FUNCTION IF EXISTS for the example PostgreSQL function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100