mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
Introduce sequelize migrations to create and migrate database tables and removed database scripts. See http://sequelizejs.com/docs/latest/migrations
Created seeds to initialize database with dummy tasks. Introduce config module to handle configurations per environment. See https://github.com/lorenwest/node-config Updated README.md to reflect changes.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
var Sequelize = require('sequelize');
|
||||
|
||||
module.exports = {
|
||||
instance: function(orm) {
|
||||
task = orm.define('Tasks', {
|
||||
id : {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
|
||||
content : {type: Sequelize.TEXT, allowNull: false},
|
||||
parent : Sequelize.INTEGER,
|
||||
isCompleted: Sequelize.BOOLEAN,
|
||||
createdAt : Sequelize.DATE,
|
||||
updatedAt : Sequelize.DATE
|
||||
});
|
||||
|
||||
orm.sync();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
var config = require('config'),
|
||||
orm = require('../../orm').configure(config.get('database')),
|
||||
Tasks = require('../../db/models/task').instance(orm);
|
||||
|
||||
Tasks.create({content: 'Welcome to HackFlowy!', isCompleted: false});
|
||||
Tasks.create({content: 'An open-source WorkFlowy clone', isCompleted: false});
|
||||
Tasks.create({content: 'Built using Backbone + Socket.IO', isCompleted: false});
|
||||
Tasks.create({content: 'I pulled this together in a few hours to learn Backbone', isCompleted: false});
|
||||
Tasks.create({content: 'Feel free to try it out and hack on it', isCompleted: false});
|
||||
Tasks.create({content: 'Good Luck!', isCompleted: false});
|
||||
|
||||
orm.sync();
|
||||
Reference in New Issue
Block a user