Closed manky closed 1 year ago
Introduction of $nullable
and $defaultValues
Arrays
We have introduced two new arrays - $nullable
and $defaultValues
. These arrays are used to specify if certain columns are allowed to be null and to provide default values to some columns respectively.
Updating $nullable
for Specific Columns
We have made changes in the code that allow us to ensure that, for specific columns which are allowed to be null, there can be entries in the $nullable
array indicating this.
Populating $defaultValues
for Given Columns
Changes have also been made that allow us to provide default values for specific columns, if any. These are then recorded in the $defaultValues
array.
Added Validation for Nullable and Default Value Columns New validation rules have been included to check the columns that are nullable or have default values. This helps in reducing errors and ensuring data integrity.
Modification in Database Driver Name Checking A modification has been made in the condition that checks the database driver name. Now, it specifically checks if the driver's name is 'pgsql' and the column type is 'integer'. This ensures more accurate and efficient checking of database driver specifications.
The line has been added to the changelog. Thanks.
Thank you!
This may sound unimportant, but if you are using yii\behaviors\AttributeTypecastBehavior and the cast depends on the rules() method of your model, for example, fields validated via yii\validators\NumberValidator and without any value will be cast to integer/float. So the value of the empty fields will become 0
An important part is that default rules should be at the beginning of the rule list.