Initial values and Default Database values
No edit summary |
|||
Line 3: | Line 3: | ||
==== DefaultDbValue ==== | ==== DefaultDbValue ==== | ||
Initial value used when evolving the database or creating the database. | Initial value used when evolving the database or creating the database. If the attribute is nullable, i.e. has '''Allow Null = true''', the DefaultDbValue is not needed | ||
This value should be in the format expected by the database engine | This value should be in the format expected by the database engine. | ||
Examples using SQL Server; | |||
* Non-nullable [[Documentation:Boolean|Boolean]]: 0 or 1 | |||
* Non-nullable [[Documentation:Decimal|Decimal]]: 0 | |||
* String: 'stringvalue' (quoted) ('''note:''' strings are always nullable if not using very old database types as char) | |||
==== Initial value ==== | ==== Initial value ==== | ||
Initial value used in-memory. | Initial value used in-memory. Should be true/false or nothing for null (if nullable) or other value depending on type of attribute. | ||
Examples; | |||
* Non-nullable [[Documentation:Boolean|Boolean]]: false or true | |||
* Non-nullable [[Documentation:Decimal|Decimal]]: 0 | |||
* String: stringvalue (no quotes) | |||
==== Allow Null ==== | ==== Allow Null ==== |
Revision as of 16:47, 16 January 2024
Property inspector for an modelled attribute
DefaultDbValue
Initial value used when evolving the database or creating the database. If the attribute is nullable, i.e. has Allow Null = true, the DefaultDbValue is not needed
This value should be in the format expected by the database engine.
Examples using SQL Server;
- Non-nullable Boolean: 0 or 1
- Non-nullable Decimal: 0
- String: 'stringvalue' (quoted) (note: strings are always nullable if not using very old database types as char)
Initial value
Initial value used in-memory. Should be true/false or nothing for null (if nullable) or other value depending on type of attribute.
Examples;
- Non-nullable Boolean: false or true
- Non-nullable Decimal: 0
- String: stringvalue (no quotes)
Allow Null
Controls both the in-memory nullability and database attribute setting.
If this is false, most database engines require a DefaultDbValue to evolve the database. If no value is provided, the existing rows (objects) in database will get an invalid value and the evolve will fail.
This page was edited more than 9 months ago on 03/26/2024. What links here