Migration Column names

Topics: General, Troubleshooting
Jul 14, 2011 at 9:17 AM

Hi,

I setup a table for storing messages without much thought, I created a table with the following names among others: From, To, Read etc...

The migration ran fine, creating the table without issue, trying to read or insert into the table caused SQL errors. It then became apparent that i had chosen a bunch of column names that were SQL keywords, hence the SQL errors.

Using FluentNHibernate in the past I have just mapped names as "From" => "[From]" which fixes the issues.

Is it possible to do this in orchard?

Whats is the best end solution:

- Don't use column names that are keywords?

- File a bug in orchard subjecting that all column names should be wrapped in "[" + "]" to prevent future problems?

- Maybe a attribute that allows column names and entities to differ?

 

Coordinator
Jul 14, 2011 at 7:06 PM

Can't you specify a different column name in the migration? Something like

.Column("keyword", DbType.String, ccc => ccc.ColumnName = "foo")