Graphql-engine: console: suspicious migrations created after column edition

Created on 27 Mar 2020  路  8Comments  路  Source: hasura/graphql-engine

I am pretty sure the console creates suspicious migrations. Here a the reproductible steps:

  • Start with a fresh Hasura instance & a fresh database as well;
  • Set up a project directory & Open the console from the CLI (as show in the documentation);
  • Create a table test with a ts column, selecting Timestamp as the type (and not Time, time without time zone nor timestamp without time zone). Use ts as the PK. You shoud see the following migration now:
CREATE TABLE "public"."test"("ts" timestamptz NOT NULL, PRIMARY KEY ("ts") );
  • Edit the ts column, change its GraphQL field name & save. Now you will see the following suspicious migrations:
ALTER TABLE "public"."test" ALTER COLUMN "ts" TYPE timestamp with time zone;
ALTER TABLE "public"."test" DROP CONSTRAINT "test_ts_key";

Hope this report will lead to a better product!

console migrations easy bug

All 8 comments

@vhiairrassary Is this timestamp with time zone vs timestamptz the problem? if not could you please explain why you think so?

@karthikvt26 I think @vhiairrassary's point is that this migration shouldn't even be generated because only the custom field name of the column is updated?

I agree and atleast with v1.2 and above this should just add an entry in tables.yaml inside metadata.

Ok looks like a way forward is to identify any change to be either metadata only or schema only or both

@karthikvt26 I think @vhiairrassary's point is that this migration shouldn't even be generated because only the custom field name of the column is updated?

Exactly! For information, I am using version 1.2.0-beta.2.

This happens only with the timestamp column. there seems to be an inconsistency while comparing the type of a timestamp column during edit which causes console to believe the type of the column has changed and hence it generates an alter column type query

_edit:_ seems to happen to varchar as well as mentioned in #3345 & #4300

This happens only with the timestamp column. there seems to be an inconsistency while comparing the type of a timestamp column during edit which causes console to believe the type of the column has changed and hence it generates an alter column type query

_edit:_ seems to happen to varchar as well as mentioned in #3345 & #4300

and integer -> int4 #4380
Is there a master references list for the custom types (hasura udt_name) mapped to postgres data_type?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lishine picture lishine  路  3Comments

shahidhk picture shahidhk  路  3Comments

tirumaraiselvan picture tirumaraiselvan  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

egislook picture egislook  路  3Comments