// {app_root}/app.js module.exports = app => { app.beforeStart(async () => { // 從配置中心獲取 MySQL 的配置 // { host: 'mysql.com', port: '3306', user: 'test_user', password: 'test_password', database: 'test' } await app.model.sync({ force: true }); }); };
- force為true 每次都會刪除表重建,false會檢測代碼中創建的model文件在程序執行時創建表