Graphql-engine: Use ADD COLUMN "IF NOT EXISTS" when generating up migrations

Created on 3 Jul 2020  路  4Comments  路  Source: hasura/graphql-engine

Right now, the up migrations are not idempotent. This is one such example.

When adding a column, simply add it only if it doesn't exist, otherwise do nothing (= migration has already been run)

console easy hacktoberfest

All 4 comments

Hi!

I'd like to contribute to this issue.

Hi @AdityaAnand1,

Thanks for the report. However, we don't want to make migrations idempotent by default. It's because they become less strict this way.
Let's say someone added a column directly with psql with a different data type. ADD COLUMN IF NOT EXISTS ... migration will succeed, but the Hasura migrations won't reflect the state of the system. You can consider adding IF EXISTS / IF NOT EXISTS manually.

I'm therefore closing this issue.

Thanks @beerose ! Yeah, it's fine, was a good opportunity to get into hasura :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjangga0214 picture jjangga0214  路  3Comments

shahidhk picture shahidhk  路  3Comments

coco98 picture coco98  路  3Comments

sachaarbonel picture sachaarbonel  路  3Comments

stereobooster picture stereobooster  路  3Comments