本文整理汇总了TypeScript中Sequelize.sync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sync函数的具体用法?TypeScript sync怎么用?TypeScript sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sync函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
return Rx.Observable.create(observer => {
sequelize.sync().then(function() {
observer.next();
observer.complete();
}).catch(err => observer.error(err));
});
开发者ID:projectSHAI,项目名称:expressgular2,代码行数:8,代码来源:index.ts
示例2: recursive
recursive(__dirname ,function (err:any, files:any) {
for(var fileIndex = files.length-1 ; fileIndex >= 0 ; fileIndex--){
var file = files[fileIndex];
if( (file.indexOf(".") !== 0) && (file.indexOf("index.js") == -1) && (file !== "index.js") && file.slice(file.indexOf("."), file.length) === ".js"){
//todo replace all recurisivly
var newFile = file.replace(__dirname,".").replace("\\","/").replace("\\","/");
var split = newFile.split("/");
split[split.length -1] = capitalizeFirstLetter(split[split.length -1]);
newFile = split.join("/");
var model = require(newFile);
if("associate" in model){
model.associate();
}
}
}
sequelize.sync({ force: false }).then(function(){
resolve();
});
})
开发者ID:lucasBertola,项目名称:Turnkey,代码行数:21,代码来源:index.ts
示例3: main
// Where
async function main() {
// await DB.sync({alter: true});
await DB.sync();
try {
const [gallanthor] = await Account.findOrCreate({
where: {name: 'Gallanthor'},
defaults: {
data: {
hasStarBesideName: true
}
}
});
console.log(gallanthor.toJSON());
// const allAccounts = await Account.findAll({where: {name: 'Gallanthor'}})
// console.log(allAccounts)
} catch (err) {
if (err.constructor === sequelize.ValidationError) {
console.log("WHAAAT")
}
console.log(err)
}
}
开发者ID:lanarts,项目名称:server,代码行数:23,代码来源:models-sql.ts
示例4:
.then(function() { return sequelize.sync({force: true}) })
开发者ID:samuelneff,项目名称:sequelize-learning,代码行数:1,代码来源:app.ts
示例5: retry
retry(3, 5000, () => db.sync()).then(() => {
开发者ID:CWSpear,项目名称:name-game,代码行数:1,代码来源:index.ts
示例6: Error
});
const bot = controller.spawn({
token,
incoming_webhook: {
url: 'https://hooks.slack.com/services/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'
}
})
.startRTM(function(err: any): void {
if (err) {
throw new Error(err);
}
});
const sequelize = new Sequelize(databaseUrl, {
dialect: 'mysql'
});
defineModels(sequelize);
sequelize.sync({force: !!options.force});
for (const conversationClass of ALL_CONVERSATIONS) {
let conversation;
if (conversationClass === Reminder) {
conversation = new Reminder(sequelize, bot, undefined, undefined, options['reminder-channel'] || undefined);
} else {
conversation = createConversation(conversationClass, sequelize, bot);
}
conversation.start();
}
开发者ID:hxjp,项目名称:simekiri-bot,代码行数:30,代码来源:bot.ts
示例7: Sequelize
import Sequelize from 'sequelize'
const database = process.env.MYSQL_DATABASE
const user = process.env.MYSQL_USER
const pass = process.env.MYSQL_PASSWORD
const db = new Sequelize(database, user, pass, {
host: 'mysql',
dialect: 'mysql',
define: {
charset: 'utf8',
collate: 'utf8_general_ci',
timestamps: true
},
})
db.sync((err) => {
console.error(err)
})
export default db
开发者ID:rymizuki,项目名称:site-animechannel,代码行数:21,代码来源:db.ts
示例8: beforeEach
beforeEach(async function(): Promise<any> {
await sequelize.sync({force: true});
await Promise.all(USER_DATA.map(user => User.create(user)));
await Promise.all(SCHEDULE_DATA.map(schedule => Schedule.create(schedule)));
});
开发者ID:hxjp,项目名称:simekiri-bot,代码行数:5,代码来源:reminder.test.ts
注:本文中的Sequelize.sync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论