Skip to content

Conversation

cmiles74
Copy link
Contributor

@cmiles74 cmiles74 commented Dec 6, 2018

This resolved an issue I was seeing when kicking the database, an InvalidCastException was logged after checking for the "ScriptsRunErrors" table. In this case the table was present and had been created by Roundhouse; I hadn't altered or customized it in anyway. I am running against MySQL 8 on Linux.

The issue doesn't appear to be with Roundhouse but is coming from the NHibernate SchemaUpdate task. Similar issues had been reported to NHibernate with various fixes, some of which involved updating the database driver. I updated the driver and this has resolved the issue.

Running RoundhousE v0.9.2.0 against mysql8.somewhere.com - test_db.
Looking in . for scripts to run.
==================================================
Setup, Backup, Create/Restore/Drop
==================================================
Creating test_db database on mysql8.somewhere.com server if it doesn't exist.
==================================================
RoundhousE Structure
==================================================
 Running database type specific tasks.
 Creating [Version] table if it doesn't exist.
 Creating [ScriptsRun] table if it doesn't exist.
 Creating [ScriptsRunErrors] table if it doesn't exist.
could not complete schema update
System.InvalidCastException: Specified cast is not valid.
   at MySql.Data.MySqlClient.SchemaProvider.GetIndexes(String[] restrictions)
   at MySql.Data.MySqlClient.ISSchemaProvider.GetSchemaInternal(String collection, String[] restrictions)
   at MySql.Data.MySqlClient.SchemaProvider.GetSchema(String collection, String[] restrictions)
   at MySql.Data.MySqlClient.MySqlConnection.GetSchema(String collectionName, String[] restrictionValues)
   at NHibernate.Dialect.Schema.AbstractTableMetadata.InitIndexes(IDataBaseSchema meta)
   at NHibernate.Dialect.Schema.AbstractTableMetadata..ctor(DataRow rs, IDataBaseSchema meta, Boolean extras)
   at NHibernate.Dialect.Schema.MySQLDataBaseSchema.GetTableMetadata(DataRow rs, Boolean extras)
   at NHibernate.Tool.hbm2ddl.DatabaseMetadata.GetTableMetadata(String name, String schema, String catalog, Boolean isQuoted)
   at NHibernate.Cfg.Configuration.GenerateSchemaUpdateScript(Dialect dialect, DatabaseMetadata databaseMetadata)
   at NHibernate.Tool.hbm2ddl.SchemaUpdate.Execute(Action`1 scriptAction, Boolean doUpdate)

@erikbra
Copy link
Member

erikbra commented Dec 11, 2018

Thanks a lot for your contribution, @cmiles74. This is probably due to a version mismatch between what is used in rh.exe and in the lib (I think). So I'm happy to take in the change.

A couple of small issues I would appreciate resolved before I merge the PR:

  1. There has been a large merge to master since your PR, so there are some conflicts. Could you please fix them?
  2. I would like the versions in all DLLs to be the same, so could you please upgrade the nuget ref in roundhouse.console and roundhouse.tests to 8.0.13 too?

@cmiles74
Copy link
Contributor Author

Sorry, I didn't think to check for other references to the driver. I have updated all references (I think) and have merged in the changes from master.
Thank you! :-)

@erikbra erikbra merged commit 2c13cae into chucknorris:master Dec 14, 2018
@erikbra
Copy link
Member

erikbra commented Dec 14, 2018

Lovely. Thanks!

@cmiles74 cmiles74 deleted the 349-1-mysql-invalid-cast branch December 18, 2018 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants