Since v8 we've been using migrations to set up our tables. We started by executing the table definitions using Database.Execute, but now we want something tied to our code. We're looking into two options; the Create.Table<T>().Do()-way (I'll call it Definition-based for now) and the Create.Table("tableName").WithColumn()-way (Fluent).
Although the Definition-based way looks quite promising, there are two drawbacks that keep us from using it and therefore leaning towards the Fluent option.
We cannot find a way (attribute) to set the default value of a column. I looked in both UmbracoCms/src/Umbraco.Core/Persistence/DatabaseAnnotations as well as NPoco/src/NPoco, but no such attribute seems to exists. Is there a way to set the default value for a column?
When using AlterColumn<TableDefinition> it seems attributes aren't take into account. I tested this by using the [NullSetting]-attribute. When using this attribute together with AlterColumn, the column remained 'not null', while using this attribute with the Create.Table makes it 'null'. Are we using it wrong, or is this a missing functionality in the AlterColumn method?
Non-fluent NPoco definition and alteration
Hi all,
Since v8 we've been using migrations to set up our tables. We started by executing the table definitions using Database.Execute, but now we want something tied to our code. We're looking into two options; the
Create.Table<T>().Do()
-way (I'll call it Definition-based for now) and theCreate.Table("tableName").WithColumn()
-way (Fluent).Although the Definition-based way looks quite promising, there are two drawbacks that keep us from using it and therefore leaning towards the Fluent option.
AlterColumn<TableDefinition>
it seems attributes aren't take into account. I tested this by using the [NullSetting]-attribute. When using this attribute together with AlterColumn, the column remained 'not null', while using this attribute with the Create.Table makes it 'null'. Are we using it wrong, or is this a missing functionality in the AlterColumn method?Thank you for any answer in advance.
Regards, Dennis
is working on a reply...