benawad / graphql-express-template

Node.js GraphQL Server template
524 stars 195 forks source link

pg npm #4

Closed gentleShark closed 7 years ago

gentleShark commented 7 years ago

seems to require pg < 7. pg 7.0.2 has connection.query(...).on error. should pg be added to package.json?

gentleShark commented 7 years ago

sequelize script hangs on the following query: Executing (default): CREATE TABLE IF NOT EXISTS "local_auths" ("id" SERIAL , "email" VARCHAR(255) UNIQUE, "password" VARCHAR(255), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" INTEGER REFERENCES "Users" ("id") ON DELETE SET NULL ON UPDATE CASCADE, UNIQUE ("email"), PRIMARY KEY ("id")); Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'local_auths' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;

setting .sync({force: true}) unfortunately didn't help.

benawad commented 7 years ago

If a package needed pg it should install it has a dependency. You could try installing it and seeing if that helps. Did you create the database before starting the server?

gentleShark commented 7 years ago

There was a error related to the pg package not being found so I installed it. pg@7.0.2 installed by default and is too new (connection.query(...).on is removed in 7) but 6.4.1 did the trick. I created the database but sequelize script hangs on querying local_auths:

"Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'local_auths' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;"

Prior to that query the other tables are created successfully.

On Fri, Jul 28, 2017 at 11:55 AM, Ben Awad notifications@github.com wrote:

If a package needed pg it should install it has a dependency. You could try installing it and seeing if that helps. Did you create the database before starting the server?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/benawad/graphql-express-template/issues/4#issuecomment-318691563, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsvTadSjcp3E5hM-1gQGrWKPjCcXmaIks5sSgR2gaJpZM4Ol-8s .

benawad commented 7 years ago

Do you just have a lot of data in your database?

gentleShark commented 7 years ago

Ben, turns out it was just user error. I just assumed sequelize had hung but really I was just looking at the last message logged to the console. I've learned a ton from watching your videos. Thanks for making them!

benawad commented 7 years ago

Glad you figured it out 👍