MSSQL Restore not working

As we are switching to Gitea I am working on a test environment. I supposed that it would be possible to do a dump and restore, but for some reason only dump is available on Gitea (which does not make sense, why not build a proper restore?).

But OK, I have to follow the procedure and do it by hand. Files are no problem, but when I try to run the generated .sql file on the new server I got an error:

Msg 8107, Level 16, State 1, Line 12
IDENTITY_INSERT is already ON for table ‘Gitea.dbo.oauth2_application’. Cannot perform SET operation for table ‘oauth2_authorization_code’.

Which is correct, the IDENTITY_INSERT is already to import the oauth2_application table. This should be set to off, but why is the off not in the script?

Part of the script generated by the dump command:
/Generated by xorm 2023-12-12 14:06:24, from mssql to mssql/
IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = ‘[oauth2_application]’ ) CREATE TABLE [oauth2_application] ([id] BIGINT PRIMARY KEY IDENTITY NOT NULL, [uid] BIGINT NULL, [name] NVARCHAR(255) NULL, [client_id] NVARCHAR(255) NULL, [client_secret] NVARCHAR(255) NULL, [confidential_client] BIT DEFAULT 1 NOT NULL, [redirect_uris] NVARCHAR(MAX) NULL, [created_unix] BIGINT NULL, [updated_unix] BIGINT NULL);
SET IDENTITY_INSERT [oauth2_application] ON;
CREATE INDEX [IDX_oauth2_application_created_unix] ON [oauth2_application] ([created_unix]);
CREATE INDEX [IDX_oauth2_application_updated_unix] ON [oauth2_application] ([updated_unix]);
CREATE INDEX [IDX_oauth2_application_uid] ON [oauth2_application] ([uid]);
CREATE UNIQUE INDEX [UQE_oauth2_application_client_id] ON [oauth2_application] ([client_id]);
INSERT INTO [oauth2_application] ([id], [uid], [name], [client_id], [client_secret], [confidential_client], [redirect_uris], [created_unix], [updated_unix])
INSERT INTO [oauth2_application] ([id], [uid], [name], [client_id], [client_secret], [confidential_client], [redirect_uris], [created_unix], [updated_unix])

IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = ‘[oauth2_authorization_code]’ ) CREATE TABLE [oauth2_authorization_code] ([id] BIGINT PRIMARY KEY IDENTITY NOT NULL, [grant_id] BIGINT NULL, [code] NVARCHAR(255) NULL, [code_challenge] NVARCHAR(255) NULL, [code_challenge_method] NVARCHAR(255) NULL, [redirect_uri] NVARCHAR(255) NULL, [valid_until] BIGINT NULL);
SET IDENTITY_INSERT [oauth2_authorization_code] ON;
CREATE UNIQUE INDEX [UQE_oauth2_authorization_code_code] ON [oauth2_authorization_code] ([code]);
CREATE INDEX [IDX_oauth2_authorization_code_valid_until] ON [oauth2_authorization_code] ([valid_until]);

IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = ‘[oauth2_grant]’ ) CREATE TABLE [oauth2_grant] ([id] BIGINT PRIMARY KEY IDENTITY NOT NULL, [user_id] BIGINT NULL, [application_id] BIGINT NULL, [counter] BIGINT DEFAULT 1 NOT NULL, [scope] NVARCHAR(MAX) NULL, [nonce] NVARCHAR(MAX) NULL, [created_unix] BIGINT NULL, [updated_unix] BIGINT NULL);
SET IDENTITY_INSERT [oauth2_grant] ON;
CREATE UNIQUE INDEX [UQE_oauth2_grant_user_application] ON [oauth2_grant] ([user_id],[application_id]);
CREATE INDEX [IDX_oauth2_grant_user_id] ON [oauth2_grant] ([user_id]);
CREATE INDEX [IDX_oauth2_grant_application_id] ON [oauth2_grant] ([application_id]);

(I have removed the INSERT values).

Anyone has a workaround on this? Except editting 10k+ lines in the .sql file and add the OFF option?