我尝试在运行Windows 2008 R2 SP1的一个系统上进行升级,尝试多次后会出现同样的错误。我们现在已经回归到5.2。实际错误是: java.lang.IllegalStateException:无法在schema_migrations上执行DROP INDEX unique_schema_migrations
以下是日志文件的一部分,该错误以导致升级失败的错误结束:
found an existing binding; you may want to run a clean build.
WARNING: while creating new bindings for class org.jruby.rack.RackInput,
found an existing binding; you may want to run a clean build.
2016.01.14 17:27:41 INFO app[o.s.p.m.Monitor] Process[web] is up
2016.01.14 17:28:01 INFO web[o.s.s.d.m.PlatformDatabaseMigration]
Starting DB Migration
2016.01.14 17:28:02 INFO web[DbMigration] == CreateUserTokens: migrating ===============================================
2016.01.14 17:28:02 INFO web[DbMigration] -- create_table("user_tokens", {})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0310s
2016.01.14 17:28:02 INFO web[DbMigration] -> 0 rows
2016.01.14 17:28:02 INFO web[DbMigration] -- index_exists?("user_tokens", "token_hash", {:name=>"user_tokens_token_hash"})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0310s
2016.01.14 17:28:02 INFO web[DbMigration] -- add_index("user_tokens", "token_hash", {:name=>"user_tokens_token_hash", :unique=>true})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0160s
2016.01.14 17:28:02 INFO web[DbMigration] -> 0 rows
2016.01.14 17:28:02 INFO web[DbMigration] -- index_exists?("user_tokens", ["login", "name"], {:name=>"user_tokens_login_name"})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0000s
2016.01.14 17:28:02 INFO web[DbMigration] -- add_index("user_tokens", ["login", "name"], {:name=>"user_tokens_login_name", :unique=>true})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0000s
2016.01.14 17:28:02 INFO web[DbMigration] -> 0 rows
2016.01.14 17:28:02 INFO web[DbMigration] == CreateUserTokens: migrated (0.0780s) ======================================
2016.01.14 17:28:02 INFO web[DbMigration]
2016.01.14 17:28:02 INFO web[DbMigration] == FixSizeOfSnapshotsQualifier: migrating ====================================
2016.01.14 17:28:02 INFO web[DbMigration] -- remove_index(:snapshots, {:name=>"snapshots_qualifier"})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0160s
2016.01.14 17:28:02 INFO web[DbMigration] -> 0 rows
2016.01.14 17:28:02 INFO web[DbMigration] -- change_column("snapshots", "qualifier", :string, {:limit=>10, :null=>true})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0000s
2016.01.14 17:28:02 INFO web[DbMigration] -- index_exists?(:snapshots, :qualifier, {:name=>"snapshots_qualifier"})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.0000s
2016.01.14 17:28:02 INFO web[DbMigration] -- add_index(:snapshots, :qualifier, {:name=>"snapshots_qualifier"})
2016.01.14 17:28:02 INFO web[DbMigration] -> 0.2500s
2016.01.14 17:28:02 INFO web[DbMigration] -> 0 rows
2016.01.14 17:28:02 INFO web[DbMigration] == FixSizeOfSnapshotsQualifier: migrated (0.2810s) ===========================
2016.01.14 17:28:02 INFO web[DbMigration]
2016.01.14 17:28:02 INFO web[DbMigration] == FixMssqlCollation: migrating ==============================================
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table characteristics
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table rules_parameters
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table rules_profiles
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table project_qprofiles
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table widgets
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table groups
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table snapshots
2016.01.14 17:28:02 INFO web[o.s.d.v.v.FixMsSqlCollation] Updating columns from table schema_migrations
2016.01.14 17:28:02 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v53.FixMsSqlCollation
java.lang.IllegalStateException: Fail to execute DROP INDEX unique_schema_migrations ON schema_migrations
at org.sonar.db.version.DdlChange$Context.execute(DdlChange.java:70) ~[sonar-db-5.3.jar:na]
提前致谢, Wes MacDonald
答案 0 :(得分:0)
看起来5.2版本中缺少索引。要解决此问题,请在表schema_migrations的5.2数据库上创建索引。这是命令
在dbo.schema_migrations(version)上创建UNIQUE CLUSTERED INDEX unique_schema_migrations;
我在此修复之后从5.2迁移到5.3