Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

ForeignKeyViolation on DBMS migration #124

Closed
rodolpheh opened this issue Jan 22, 2021 · 0 comments
Closed

ForeignKeyViolation on DBMS migration #124

rodolpheh opened this issue Jan 22, 2021 · 0 comments

Comments

@rodolpheh
Copy link

rodolpheh commented Jan 22, 2021

Hello,

I tried to make the migration of the SQLite DB following the 0.2.0 update. I'm using Docker. These are the steps I follow :

  • Stop the bridge
  • Add a new postgresql to my docker-compose
  • Enter the bash prompt in the bridge
  • Run alembic -x config=/data/config.yaml upgrade head
  • Run python3 -m mautrix_facebook.db.legacy_migrate -f sqlite:////data/mautrix-facebook.db -t postgres://mautrixfacebook:xxxxxxxxxxxxxxxx@facebook-db/mautrixfacebook

Everything seems to be okay for alembic and it seems to run well until it hits an error :

Connecting to old database
Reading table Portal... Done!
Reading table Message... Done!
Reading table Puppet... Done!
Reading table User... Done!
Reading table UserPortal... Done!
Reading table RoomState... Done!
Reading table UserProfile... Done!
Reading table Contact... Done!
Reading table Reaction... Done!
Connecting to new database
Writing table Portal..... Done!
Writing table Message..... Done!
Writing table Puppet..... Done!
Writing table User.. Done!
Writing table UserPortal...Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1283, in _execute_context
    self.dialect.do_execute(
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.ForeignKeyViolation: insert or update on table "user_portal" violates foreign key constraint "user_portal_portal_portal_receiver_fkey"
DETAIL:  Key (portal, portal_receiver)=(1590835028, 100008435837242) is not present in table "portal".

Could there be an issue with my previous DB ?

@tulir tulir closed this as completed in 251eb81 Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant