-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Possible bug when migrating from sqlite to postgres [with workaround] #5651
Comments
Closed with #5680 |
For anybody getting here with google:
Also applies to #6090 |
I did the conversion to postgres 11 but there was an error with table creation saying that the value was a bool but the default value was of type integer. I replaced all instances of On top of that I had to apply the workaround provided by belminf in #4407 |
This one actually does work. I used following pgloader configuration for migrating data from sqlite:
|
>> BE ADVISED<<
If you find this issue in the future do not try to reproduce this ended up rendering
the gitea my instance read only and I had to revert back to sqlite.
Hello everyone,I tried to migrate from sqlite to postgresql manually today.
I did run into some problems doing it the conventional way so
I figured I might as well document the experience and potentially
narrow down the problem so it can be fixed.
Short description
The problem seems to be the generated sql file (
gitea dump -d postgres [..]
)contains both
INSERT
andCREATE
statements -- which does not fly well withpsql
because it errors out if its not in order.This puts the database in an incomplete state and you cannot run the app afterwards.I did get it to work with the help of @zeripath by first running the postgres migrations, and then "blindly" importing the psql file when the relations already exist.What I tried initially
gitea dump -d postgres -c /path/to/app.ini
app.ini
for postgresqlpsql -d gitea -f backup.sql
But that generates errors like:
Now, I know thedump
command has been reimplemented in @lunny's PR over here so after that has been merged thismight no longer be a problem.
But long story short its impossible to restore the sql file
What I ended up having to do:
I dumped thesqlite3
schema+data viaConfigured theapp.ini
to have a postgres instance accessible.Run the app once, to initialise the migration processPray there is noDELETE
statements in sql file, since it does miss a fewCREATE IF NOT EXIST
statements.Run the app againProfit[x]
):The text was updated successfully, but these errors were encountered: