Skip to content

Commit

Permalink
fix: column data not consistent across all dbms (#108)
Browse files Browse the repository at this point in the history
fix: regexp in model attr set function
  • Loading branch information
zacharygolba committed May 20, 2016
1 parent 7c897ae commit 71a1be6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/packages/database/model/utils/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ function initializeProps(prototype, attributes, relationships) {
if (nextValue !== currentValue) {
const { initialized, initialValues } = this;

if (type === 'tinyint') {
if (/^(boolean|tinyint)$/.test(type)) {
nextValue = Boolean(nextValue);
} else if (type === 'datetime' && typeof nextValue === 'number') {
nextValue = new Date(nextValue);
} else if (!nextValue && !nullable) {
return;
}
Expand Down

0 comments on commit 71a1be6

Please sign in to comment.