This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
How do you go about setting the precision of a decimal field in a migration? |
|
|
At the moment, this requires you to explicitly specify the native database type as a literal string in the Field constructor. For example, change new Field("WonderField", ModelDataType.Decimal, false) to new Field("WonderField", "DECIMAL(24, 18)", false) Obviously this results in non-portable migration code though. We want to improve this at some point so if portability is a concern for you then let us know and we'll try to bump it up the priority list. |
|
|
Portability is a huge priority for us at this point. Thanks for the info, though. |
|
|
Okay, we'll bump this up the list. What's the urgency on this? Can you use the literal name for ongoing development while we work on implementing a portable solution? Which databases are must-have for you? |
|
|
On further investigation, DECIMAL(p,s) (or NUMERIC(p,s)) seems to be portable across major databases (I've looked at SQL Server, Oracle, MySQL and PostgreSQL so far). So if you currently only require precision control for decimal columns, this shouldn't be an issue after all. If you need portable precision control for less standard data types, let us know the details. |
|
|
Thanks for letting me know. We'll use DECIMAL(p,s) for now, and if anything else comes up I'll let you know. |
|