Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3 migration to MySQL or Postgress #47

Open
preussal opened this issue Feb 5, 2024 · 6 comments
Open

sqlite3 migration to MySQL or Postgress #47

preussal opened this issue Feb 5, 2024 · 6 comments
Labels
question Further information is requested

Comments

@preussal
Copy link

preussal commented Feb 5, 2024

Do you have instructions on how to migrate the SQLight Database to MySQL or Postgress?

I have now the problem with ~ 60 mirrors that I keep getting
“sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked”

only a restart of all 3 service help to resolve this for a short time

@Salamek
Copy link
Owner

Salamek commented Feb 5, 2024

You installed this project from source?

@preussal
Copy link
Author

preussal commented Feb 5, 2024

with apt.
and then i do the installation procedure
no docker contrainer

@Salamek
Copy link
Owner

Salamek commented Feb 5, 2024

ah i see, this project uses old setup script... crap...

Well i have written guide how to migrate here https://github.com/Salamek/gitlab-tools/blob/master/doc/PostgreSQL.md
untested...

@Salamek Salamek added the question Further information is requested label Feb 5, 2024
@preussal
Copy link
Author

preussal commented Feb 5, 2024

Thank you,
Installation - Check
Create DB - Check

Migration need also install sqlite3
apt-get install sqlite3

Migration Dump export

root@gitlab:/home/gitlab-tools # sqlite3 gitlab-tools.db .schema > schema.sql
root@gitlab:/home/gitlab-tools # sqlite3 gitlab-tools.db .dump > dump.sql
root@gitlab:/home/gitlab-tools # grep -vx -f schema.sql dump.sql > data.sql

Check

But the import Fails

root@gitlab.:/home/gitlab-tools # su postgres
postgres@gitlab:/home/gitlab-tools$ psql gitlab_tools < /home/gitlab-tools/data.sql
ERROR:  syntax error at or near "PRAGMA"
LINE 1: PRAGMA foreign_keys=OFF;
        ^
BEGIN
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
ERROR:  syntax error at or near "user"
LINE 1: INSERT INTO user VALUES('2024-02-05 12:42:41','2024-02-05 12...
                    ^
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block

I think i need to Cleanup the Dump
This Lines to a lot of truble
INSERT INTO celery_taskmeta VALUES(4207,'e777290c-d716-4492-93ae-f99bf8d0a3a0','FAILURE',X'80059581.........

@preussal
Copy link
Author

preussal commented Feb 5, 2024

I found the mistake, both in the SQLITE3 DB and in the Postresql.
My name contains a "ß" (German Special ä ö ü ß) and in the db dump from gitlab-tools it is something like the "a/o = n" and that somehow breaks.

ERROR:  syntax error at or near "user"
LINE 1: INSERT INTO user VALUES('2024-02-05 12:42:41','2024-02-05 12...

I changed my name and now the SQLITE3 DB is going again :)

@Salamek
Copy link
Owner

Salamek commented Feb 5, 2024

Yes dump will most likely need some manual cleanup (some commands may not be supported etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants