Add defaults to model

This commit is contained in:
2016-01-29 13:08:18 +08:00
parent 5ca28942e6
commit 84a86facfc
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -5,10 +5,11 @@ module.exports = {
task = orm.define('Tasks', {
id : {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
content : {type: Sequelize.TEXT, allowNull: false},
parent : Sequelize.INTEGER,
isCompleted: Sequelize.BOOLEAN,
parentId : {type: Sequelize.INTEGER, defaultValue: 0},
isCompleted: {type: Sequelize.BOOLEAN, defaultValue: false},
priority : {type: Sequelize.INTEGER, defaultValue: 0},
createdAt : Sequelize.DATE,
updatedAt : Sequelize.DATE
updatedAt : Sequelize.DATE,
});
orm.sync();
+1 -1
View File
@@ -7,7 +7,7 @@ Tasks.destroy({where: {}}).then(function() {
{content: 'Welcome to HackFlowy!', isCompleted: false},
{content: 'An open-source WorkFlowy clone', isCompleted: false},
{content: 'Built using Backbone + Socket.IO', isCompleted: false},
{content: 'I pulled this together in a few hours to learn Backbone', isCompleted: false},
{content: 'Desyncr pulled this together in a few hours to learn Backbone', isCompleted: false},
{content: 'Feel free to try it out and hack on it', isCompleted: false},
{content: 'Good Luck!', isCompleted: false}
]);