Open xelnage opened 3 years ago
1、在新版本根目录创建sscms.json文件:
{ "Database": { "Type": "MySql", "ConnectionString": "" } }
填入老版本数据库信息
2、运行 sscms data backup -d backup
数据库备份命令
3、运行 sscms data update -d backup
数据库升级命令
4、创建新数据库,把新数据库的链接信息放入sscms.json文件
5、运行 sscms data restore -d update
数据库恢复命令
看看是不是按这个步骤来的
1、在新版本根目录创建sscms.json文件:
{ "Database": { "Type": "MySql", "ConnectionString": "" } }
填入老版本数据库信息
2、运行
sscms data backup -d backup
数据库备份命令 3、运行sscms data update -d backup
数据库升级命令 4、创建新数据库,把新数据库的链接信息放入sscms.json文件 5、运行sscms data restore -d update
数据库恢复命令看看是不是按这个步骤来的
请仔细看日志
内容表和站点表迁移报错,其它表已迁移成功。 { "dateTime": "2020-12-22 16:09:05", "detail": "插入表 siteserverContent, 文件名 1.json", "message": "关键字 'Top' 附近有语法错误。", "stackTrace": " at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\r\n at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()\r\n at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)\r\n at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)\r\n at System.Threading.Tasks.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action
1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in //Dapper/SqlMapper.Async.cs:line 687\r\n at Datory.Utils.RepositoryUtils.InsertRowsAsync(IDatabase database, String tableName, String columnNames, List1 valuesList, DynamicParameters parameterList)\r\n at Datory.Utils.RepositoryUtils.BulkInsertAsync(IDatabase database, String tableName, List
1 tableColumns, IEnumerable1 items)\r\n at Datory.Utils.RepositoryUtils.BulkInsertAsync(IDatabase database, String tableName, List
1 tableColumns, IEnumerable1 items)\r\n at Datory.Repository.BulkInsertAsync(IEnumerable
1 items)\r\n at SSCMS.Cli.Services.DataRestoreService.RestoreAsync(List1 includes, List
1 excludes, Boolean dataOnly, String tablesFilePath, TreeInfo treeInfo, String errorLogFilePath)" }{ "dateTime": "2020-12-22 16:09:43", "detail": "插入表 siteserver_Site, 文件名 1.json", "message": "当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'siteserverSite' 中的标识列插入显式值。", "stackTrace": " at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\r\n at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()\r\n at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)\r\n at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)\r\n at System.Threading.Tasks.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action
1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in //Dapper/SqlMapper.Async.cs:line 687\r\n at Datory.Utils.RepositoryUtils.InsertRowsAsync(IDatabase database, String tableName, String columnNames, List1 valuesList, DynamicParameters parameterList)\r\n at Datory.Utils.RepositoryUtils.BulkInsertAsync(IDatabase database, String tableName, List
1 tableColumns, IEnumerable1 items)\r\n at Datory.Utils.RepositoryUtils.BulkInsertAsync(IDatabase database, String tableName, List
1 tableColumns, IEnumerable1 items)\r\n at Datory.Repository.BulkInsertAsync(IEnumerable
1 items)\r\n at SSCMS.Cli.Services.DataRestoreService.RestoreAsync(List1 includes, List
1 excludes, Boolean dataOnly, String tablesFilePath, TreeInfo treeInfo, String errorLogFilePath)" }