Created
August 22, 2013 03:31
-
-
Save thomasboyt/6302912 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequelize = require("sequelize") | |
sequelize = new Sequelize('database', 'username', 'password', { | |
dialect: 'sqlite', | |
}) | |
Post = sequelize.define('Post', { | |
title: Sequelize.STRING | |
date: Sequelize.DATE | |
body: Sequelize.TEXT | |
}) | |
Post.sync() | |
post = Post.build({ | |
title: 'first post' | |
date: Date.now() | |
body: 'This is an autogenerated post' | |
}) | |
post.save().error((err) -> | |
console.log 'Error while saving: ' + err | |
).success(() -> | |
console.log 'Saved properly' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment