不要怂,就是干,撸起袖子干!

model-sync.ejs 555 Bytes
// create my nice tables:
Project.sync() // will emit success or failure event
Task.sync() // will emit success or failure event

// force the creation!
Project.sync({force: true}) // this will drop the table first and re-create it afterwards

// drop the tables:
Project.drop() // will emit success or failure event
Task.drop() // will emit success or failure event

// event handling:
Project.[sync|drop]().on('success', function() {
  // ok ... everything is nice!
}).on('failure', function() {
  // oooh, did you entered wrong database credentials?
})