-
-
Save championswimmer/8186d080e7d0a23854112aefbca6021d 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
const Sequelize = require('sequelize') | |
const db = new Sequelize('db', 'user', 'pass', { | |
dialect: 'postgres' | |
}) | |
const User = db.define('users', { | |
// line A | |
name: Sequelize.STRING, | |
age: Sequelize.INTEGER, | |
city: Sequelize.STRING, | |
isAdmin: {type: Sequelize.BOOLEAN, defaultValue: false} | |
}) | |
db.sync().then(() => { | |
User.create({ | |
// line B | |
name: 'Arnav', age: 23, city: 'Delhi', isAdmin: true | |
}).then(user => { | |
// line C | |
console.log(user.age) // 23 | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment