fioprotocol / fio-registrations

FIO protocol domain and address registration
MIT License
5 stars 9 forks source link

Cyclic table references #86

Closed i-love-to-code closed 3 years ago

i-love-to-code commented 3 years ago

When trying to sync the database, I get errors for cyclic references in the model:

Unhandled rejection Error: Cyclic dependency found. account_pay_event is dependent of itself. Dependency chain: account_pay_event -> account_pay => account_pay_event

Unhandled rejection Error: Cyclic dependency found. blockchain_trx_event is dependent of itself. Dependency chain: blockchain_trx_event -> blockchain_trx => blockchain_trx_event

Adding constraints: false to the relationships in question gets me through, but with the side effects. Is this a known issue? This discussion is where I found my fix. I use Objection with MySQL so am not familiar with Sequelize.

Running with a fresh Postgres 13 Docker image (13-alpine).

ericbutz commented 3 years ago

Created issue to track: https://fioprotocol.atlassian.net/browse/BD-2249

ericbutz commented 3 years ago

@blockpane have you seen something similar when trying to sync?

i-love-to-code commented 3 years ago

Have pushed the changes I made to get the migrations running: https://github.com/eosdublin/fio-registrations/commit/fc5fafc3f0e5e9ae609531b52c0e662163feec4c

ericbutz commented 3 years ago

From Todd Garrison November 27, 2020, 5:34 PM

I’ve run into this before, usually it has to do with the sync being part of the post-install steps. Assuming the DATABASE_URL variable is set in the .env file (or is exported via the shell’s environment.) I would try changing line 20 of the package.json from:

"postinstall": "npm run sync && npm run migrate && npm run seed"

to

"postinstall": "npm run migrate && npm run seed"

It’s probably one of those two.