Comments (18)
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.
Same happening to me updating v1.0.0 to v1.1.0 :(
from graphql-engine-heroku.
Facing similar issue while updated to v1.0.0
Any update on this?
from graphql-engine-heroku.
@danrha Can you send me the results of the following 2 sql queries on your postgres instance:
select * from hdb_catalog.hdb_version
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.
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.
@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.
@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.
@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.
@tirumaraiselvan PG version:
postgres --version
postgres (PostgreSQL) 12.1 (Debian 12.1-1.pgdg100+1)
from graphql-engine-heroku.
@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.
@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.
@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
:
-
Stop Hasura v1.0.0
-
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;
- Start Hasura v1.0.0
- Upgrade Hasura to v1.1.0
from graphql-engine-heroku.
@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.
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.
@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.
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.
Related to: hasura/graphql-engine#4009
Particularly, this comment: hasura/graphql-engine#4009 (comment)
from graphql-engine-heroku.
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)
- 'no mutations exist' when using a valid role HOT 1
- "We're sorry, but something went wrong." HOT 3
- Up PG Connections to 20 (or 18)
- Error when host hasura on heroku using Dockerfile with migrations/metadada files setup HOT 2
- 1-Click Deploy - App Crashing HOT 2
- Can't deploy using 1 click HOT 5
- OpenSSL 3 security fixes in Heroku
- Not able to deploy hasura graphql engine on Heroku
- Can Hasura be autoscaled on Heroku? HOT 1
- Deployment via heroku fails HOT 1
- --server-port should be --port HOT 1
- Error when upgrading Postgres version
- Deployment failing on Heroku HOT 4
- Stuck loading on Safari HOT 2
- Heroku instance of Hasura not working HOT 3
- Cannot connect Hasura with custom postgres db on Heroku
- How to deploy v2.0 to Heroku with "deploy button"? HOT 1
- Broken links in README.md HOT 1
- Is there a reason to not use HASURA_GRAPHQL_DATABASE_URL as env variable name? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-engine-heroku.