I just migrated our Gitea install from a local PostgreSQL database to a MSSQL server managed by our IT department.
This is what I did:
- Stop Gitea
- Do a dump with the
--database mssql
argument - Extract the .sql file from the zip
- To enable running it multiple times for testing, I inserted “drop tables” before the creation of the tables. Search for
IF NOT EXISTS \(SELECT \[name\] FROM sys\.tables WHERE \[name\] = '\[(.+)\]' \)
replace withDROP TABLE IF EXISTS [$1];
- Add “SET IDENTITY_INSERT [XXXX] OFF;” after every table that sets is to ON (I did this manually)
- Remove
SET IDENTITY_INSERT [notification] ON;
for any table that did not have an IDENTITY column. - Run the script on the new MSSQL database.
- Change the gitea config file to use the MSSQL database instead of the old PostgreSQL
- Start Gitea again
- Login and test
This worked for me, YMMV.