Hi,
I'm trying to add a column to an existing table. I added a property to the mapping :
<property name="SelectionId" column="selection_id" not-null="true"/>
When I open the session, the new column is created, however the not-null
attribute is not taken into account : the new column is nullable.
I realize you need to specify a default value when adding a non-nullable column, but there is no default
or default-value
attribute for the <property>
element... And anyway, I don't want a default value on this column : I want to set a specific value (0) for it on existing rows, but subsequent inserts will have to specify the value explicitly.
How can I make it work ? Do I have to do it manually in SQL ?
BTW, the underlying DBMS is SQLite, which has very limited support for ALTER TABLE
(only add column and rename table are supported)...