migrate local sqllite3 database to MySQL (mariadb) database #6032

Closed
opened 2025-11-02 06:43:13 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @TheRojam on GitHub (Sep 20, 2020).

  • Gitea version: 1.12.4
  • Git version: git version 2.24.3
  • Operating system: CentOS Linux release 7.8.2003
  • Database (use [x]):
    • PostgreSQL
    • MySQL (migration target)
    • MSSQL
    • SQLite (base)
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
    2020/09/20 15:27:33 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: sync database struct error:
    Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for
    the right syntax to use near 'release MODIFY COLUMN tag_name VARCHAR(255) NULL' at line 1

Description

I would like to migrate my local sqllite3 database to an MySQL (mariadb).
I tried to gitea dump and import the database directly into the mysql database mentioned in the configuration file.
After this my gittea throws 50x errors.

And in the log i can see this error.

2020/09/20 15:27:33 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: sync database struct error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'release MODIFY COLUMN tag_name VARCHAR(255) NULL' at line 1

May i need to mention that i do not have any have such a great knowledge about databases.

Does anyone has an good idea to do this?

Many thanks.

Originally created by @TheRojam on GitHub (Sep 20, 2020). - Gitea version: 1.12.4 - Git version: git version 2.24.3 - Operating system: CentOS Linux release 7.8.2003 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL (migration target) - [ ] MSSQL - [x] SQLite (base) - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: 2020/09/20 15:27:33 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: sync database struct error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'release MODIFY COLUMN `tag_name` VARCHAR(255) NULL' at line 1 ### Description I would like to migrate my local sqllite3 database to an MySQL (mariadb). I tried to `gitea dump` and import the database directly into the mysql database mentioned in the configuration file. After this my gittea throws 50x errors. And in the log i can see this error. >`2020/09/20 15:27:33 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: sync database struct error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'release MODIFY COLUMN `tag_name` VARCHAR(255) NULL' at line 1` May i need to mention that i do not have any have such a great knowledge about databases. Does anyone has an good idea to do this? Many thanks.
GiteaMirror added the type/question label 2025-11-02 06:43:13 -06:00
Author
Owner

@6543 commented on GitHub (Sep 20, 2020):

@TheRojam did you specify he DBMS with the --database flag on dump ?

@6543 commented on GitHub (Sep 20, 2020): @TheRojam did you specify he DBMS with the `--database` flag on **dump** ?
Author
Owner

@bagasme commented on GitHub (Sep 24, 2020):

@TheRojam Can you post log before your DB error? That means, what is the complete query that trigger the error?

@bagasme commented on GitHub (Sep 24, 2020): @TheRojam Can you post log before your DB error? That means, what is the complete query that trigger the error?
Author
Owner

@jarvis0325 commented on GitHub (Oct 27, 2020):

FYI
https://inhji.de/blog/migrate-gitea-from-sqlite-to-postgres/

Below is my step list

  1. dump your gitea environment
  2. Use db tool to create new gitea database
  3. Run a new gitea for your new gitea database
  4. check if the tables of your gitea database are auto-create
  5. open your gitea dump sql file
  6. find all insert scripts and then import to gitea database
  7. Fix Sequences which need to begin the max id
  8. change your gitea app.int > database setting to gitea database
@jarvis0325 commented on GitHub (Oct 27, 2020): FYI https://inhji.de/blog/migrate-gitea-from-sqlite-to-postgres/ Below is my step list 1. dump your gitea environment 2. Use db tool to create new gitea database 3. Run a new gitea for your new gitea database 4. check if the tables of your gitea database are auto-create 5. open your gitea dump sql file 6. find all insert scripts and then import to gitea database 7. Fix Sequences which need to begin the max id 8. change your gitea app.int > database setting to gitea database
Author
Owner
@6543 commented on GitHub (Mar 22, 2021): > FYI > https://inhji.de/blog/migrate-gitea-from-sqlite-to-postgres/ > > ... https://web.archive.org/web/20200812160657/https://inhji.de/blog/migrate-gitea-from-sqlite-to-postgres/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6032