chucknorris / roundhouse

RoundhousE is a Database Migration Utility for .NET using sql files and versioning based on source control
http://projectroundhouse.org
916 stars 249 forks source link

MySQL delimiter issues inside strings #377

Closed TheSkorm closed 5 years ago

TheSkorm commented 5 years ago

Similar to #349 - Versions : 1.0.4 and 1.0.3

MySQL migrations that include delimiters within a string seem to break the parser.

The following up script results in an error.

ALTER TABLE `table_name` 
CHANGE COLUMN `superseded` `superseded` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'this is a test; test 123' ;
RoundhousE encountered an error.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at roundhouse.databases.mysql.MySqlDatabase.run_sql(String sql_to_run, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse.databases.mysql\MySqlDatabase.cs:line 193
   at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String sql_to_run, String script_name, Boolean run_this_script_once, Boolean run_this_script_every_time, Int64 version_id, EnvironmentSet environment_set, String repository_version, String repository_path, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\migrators\DefaultDatabaseMigrator.cs:line 209
   at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, EnvironmentSet migrating_environment_set, String repository_version, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 290
   at roundhouse.runners.RoundhouseMigrationRunner.log_and_traverse(MigrationsFolder folder, Int64 version_id, String new_version, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 222
   at roundhouse.runners.RoundhouseMigrationRunner.run() in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 145
Index was outside the bounds of the array.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at roundhouse.databases.mysql.MySqlDatabase.run_sql(String sql_to_run, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse.databases.mysql\MySqlDatabase.cs:line 193
   at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String sql_to_run, String script_name, Boolean run_this_script_once, Boolean run_this_script_every_time, Int64 version_id, EnvironmentSet environment_set, String repository_version, String repository_path, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\migrators\DefaultDatabaseMigrator.cs:line 209
   at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, EnvironmentSet migrating_environment_set, String repository_version, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 290
   at roundhouse.runners.RoundhouseMigrationRunner.log_and_traverse(MigrationsFolder folder, Int64 version_id, String new_version, ConnectionType connection_type) in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 222
   at roundhouse.runners.RoundhouseMigrationRunner.run() in C:\projects\roundhouse\product\roundhouse\runners\RoundhouseMigrationRunner.cs:line 145
   at roundhouse.console.Program.run_migrator(ConfigurationPropertyHolder configuration) in C:\projects\roundhouse\product\roundhouse.console\Program.cs:line 558
   at roundhouse.console.Program.Main(String[] args) in C:\projects\roundhouse\product\roundhouse.console\Program.cs:line 65
cmiles74 commented 5 years ago

I think pull request #376 will fix this.

TheSkorm commented 5 years ago

Yup, this sounds like some of the issues we've been having.