
subsonicproject - issue #65
Patch inside: Lot of improvements for Migration / MySQL
Since the codeplex issue tracker seems to be replaced with this one and the subsonic development moves on I post my modification from http://www.codeplex.com/subsonic/WorkItem/View.aspx?WorkItemId=18988 again. Most of them are migration related and, since we only work with mysql, my changes aren't tested with other dbs but should be considered as stable. It would be nice if someone with commit privileges could review the patch and integrate in the trunk, because I think many other could benefit from this
Here are the details of the changes:
MySQL Code Generation: - fixed bug: "Alter Table tablename Alter Column" does not work for MySQL, changed to "Alter Table tablename MODIFY Column" See http://dev.mysql.com/doc/refman/5.0/en/alter-table.html - DbType.Double return Double for MySql - Table.AddLongText creates Text Column instead of varchar - Added Unsigned Keyword for DbType.UInt16, DbType.UInt32, DbType.UInt64
Migrations: - if a migration fails the output from sonic.exe contains the migrations sql so the error is easier to track - added possibility to not actually run the migration against a database but only show the generated sql: migrate /dumptofile output.sql - Appends the generated sql to file output.sql migrate /dumptofile STDOUT - if filename = STDOUT, the generated sql is printed to console (nice for debugging within visual studio) - added reference to System.Transactions.dll to CodeRunner (in order to use a TransactionScope with mysql, because global transactions don't seem to work with mysql (caution: mysql sometimes implicit commits transactions i.e. if you create a table and inserts a row) - if MigrationDirection is Down the outputs reads "Rolling back" instead of "Migration to" - Possibility to add a Index (only tested with mysql) AddIndex("TableName", "IDX_NAME", "column"); or with multiple columns... AddIndex("TableName", "IDX_NAME", new string[] { "column1", "column2}); DropIndex("TableName", "IDX_NAME"); - Extended the AlterColumn Statement to define the position of the new column. AlterColumn("TableName", "ColumnName", System.Data.DbType.String, 0, false, "", "orderColumn"); // <- Column will be placed after "orderColumn" - fixed bug: subcommander crashed when a migration has no steps
Subsonic: fixed bug: RepositoryRecord.Save<T> called ValidateColumnSettings() even if ValidateWhenSaving was false
- subsonicproject.patch 24.89KB
Comment #1
Posted on Apr 16, 2009 by Happy RhinoI forgot to mention that the modifications are from version 486. I haven't tested yet if they would cause any conflicts in the head release.
Status: New
Labels:
Type-Defect
Priority-Medium