Giter VIP home page Giter VIP logo

Comments (18)

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024 3

Closing this as problem was that the column default was getting dropped. The column default gets dropped when pgcrypto is dropped or public schema is dropped.

The solution is to install pgcrypto and set the default back. For e.g.

ALTER TABLE hdb_catalog.hdb_version ALTER COLUMN hasura_uuid SET DEFAULT gen_random_uuid()

Also, tracking similar issue in main repo here: hasura/graphql-engine#4009

from graphql-engine-heroku.

danrha avatar danrha commented on May 18, 2024 1

Same happening to me updating v1.0.0 to v1.1.0 :(

from graphql-engine-heroku.

lakshmanpasala avatar lakshmanpasala commented on May 18, 2024

Facing similar issue while updated to v1.0.0
Any update on this?

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@danrha Can you send me the results of the following 2 sql queries on your postgres instance:

  1. select * from hdb_catalog.hdb_version
  2. select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_schema = 'hdb_catalog' and table_name = 'hdb_version';

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

Hi,
@tirumaraiselvan, I have the same problem with upgrading from 1.0.0 to 1.1.0 and the result of the queries is:

select * from hdb_catalog.hdb_version;
             hasura_uuid              | version |          upgraded_on          | cli_state |            console_sta
te             
--------------------------------------+---------+-------------------------------+-----------+-----------------------
---------------
 cc0447d8-5d56-4fea-84b7-a5f2fd4512ab | 28      | 2019-12-23 07:49:05.254051+00 | {}        | {"telemetryNotificatio
nShown": true}
select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_schema = 'hdb_catalog' and table_name = 'hdb_version';
  column_name  |        data_type         | character_maximum_length 
---------------+--------------------------+--------------------------
 hasura_uuid   | uuid                     |                         
 version       | text                     |                         
 upgraded_on   | timestamp with time zone |                         
 cli_state     | jsonb                    |                         
 console_state | jsonb                    |

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex Thanks for the info. Everything looks fine here.

Can you pls perform the following query through psql or some client on your database and report the result:

BEGIN;
    INSERT INTO hdb_catalog.hdb_version (version, upgraded_on) VALUES (31, now())
    ON CONFLICT ((version IS NOT NULL))
    DO UPDATE SET version = 31, upgraded_on = now();
ROLLBACK;

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

@tirumaraiselvan The result is:

ERROR: null value in column "hasura_uuid" violates not-null constraint
DETAIL: Failing row contains (null, 31, 2020-03-17 12:36:14.446016+00, {}, {}).

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex We seem to have isolated the issue! The statement above was expected to have succeeded.

Finally, could you tell your postgres version?

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

@tirumaraiselvan PG version:

postgres --version
postgres (PostgreSQL) 12.1 (Debian 12.1-1.pgdg100+1)

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex Thanks. Could you pls run this query and report the result:

SELECT * FROM pg_indexes WHERE schemaname = 'hdb_catalog' and tablename = 'hdb_version';

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

@tirumaraiselvan
Output:

 schemaname  |  tablename  |      indexname      | tablespace |                                                 indexdef                                        
         
-------------+-------------+---------------------+------------+-------------------------------------------------------------------------------------------------
---------
 hdb_catalog | hdb_version | hdb_version_pkey    |            | CREATE UNIQUE INDEX hdb_version_pkey ON hdb_catalog.hdb_version USING btree (hasura_uuid)
 hdb_catalog | hdb_version | hdb_version_one_row |            | CREATE UNIQUE INDEX hdb_version_one_row ON hdb_catalog.hdb_version USING btree (((version IS NOT NULL)))

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex I am not able to repro this still. I am guessing this might be a problem with Heroku pg: https://help.heroku.com/RKRZV2NO/how-do-i-fix-a-corrupted-index

Here is something that you can try on your current database which is on v1.0.0:

  1. Stop Hasura v1.0.0

  2. Run the following SQL

BEGIN;

DROP TABLE hdb_catalog.hdb_version;

CREATE TABLE hdb_catalog.hdb_version (
    hasura_uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    version TEXT NOT NULL,
    upgraded_on TIMESTAMPTZ NOT NULL,
    cli_state JSONB NOT NULL DEFAULT '{}'::jsonb,
    console_state JSONB NOT NULL DEFAULT '{}'::jsonb
);

CREATE UNIQUE INDEX hdb_version_one_row
ON hdb_catalog.hdb_version((version IS NOT NULL));

INSERT INTO hdb_catalog.hdb_version (version, upgraded_on) values (28, now());

COMMIT;
  1. Start Hasura v1.0.0
  2. Upgrade Hasura to v1.1.0

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex Can you also send me the result of

SELECT column_name, column_default
FROM information_schema.columns
WHERE (table_schema, table_name) = ('hdb_catalog', 'hdb_version')
ORDER BY ordinal_position;

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

@tirumaraiselvan

I am not able to repro this still. I am guessing this might be a problem with Heroku pg

Oh, I just found this bug in the Google and not looking to the repo name. I use a self-hosted Hasura installation. And it's running in docker(including the Pg).

My Dockerfile is:

FROM hasura/graphql-engine:v1.1.0.cli-migrations

# Workaround for k8s
RUN mkdir -p /usr/sbin/.hasura && chmod 777 /usr/sbin/.hasura

COPY ./migrations /hasura-migrations

Run the following SQL ...

This workaround works for upgrading

{"type":"startup","timestamp":"2020-03-18T07:14:31.126+0000","level":"info","detail":{"kind":"db_migrate","info":"Successfully migrated from catalog version 28 to version 31."}}

But the migrations not applied and API does not start. I got an error with a very very big SQL error.

Also, the result of the latest query is:

  column_name  |  column_default   
---------------+-------------------
 hasura_uuid   | gen_random_uuid()
 version       | 
 upgraded_on   | 
 cli_state     | '{}'::jsonb
 console_state | '{}'::jsonb

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

@Difrex Okay, so you have successfully upgraded. But migrations are not working? Could you open a new issue in https://github.com/hasura/graphql-engine/issues with relevant details (maybe shorten the sql to relevant portions only )?

from graphql-engine-heroku.

Difrex avatar Difrex commented on May 18, 2024

Okay, so you have successfully upgraded.

Yep, thank you!

But migrations are not working? Could you open a new issue in https://github.com/hasura/graphql-engine/issues with relevant details (maybe shorten the sql to relevant portions only )?

Before creating an issue I'll try to looking deep to the error message. Maybe migrations do not apply because I have custom functions.

from graphql-engine-heroku.

tirumaraiselvan avatar tirumaraiselvan commented on May 18, 2024

Related to: hasura/graphql-engine#4009

Particularly, this comment: hasura/graphql-engine#4009 (comment)

from graphql-engine-heroku.

mehmetaydogduu avatar mehmetaydogduu commented on May 18, 2024

I tried very hard considering the information here, but could't have a success upgrade from 1.1.1 to 1.2.0. Hasura layer is working as production so I cancelled process at this time.

from graphql-engine-heroku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.