修改表唯一约束

This commit is contained in:
whyour
2022-01-27 00:49:44 +08:00
parent b56a681b98
commit 2aec1f9846
7 changed files with 23 additions and 15 deletions
+10 -1
View File
@@ -11,9 +11,18 @@ import { sequelize } from '../data';
export default async () => {
try {
await sequelize.sync({ alter: true });
await sequelize.sync();
await new Promise((resolve) => setTimeout(() => resolve(null), 5000));
// try {
// const queryInterface = sequelize.getQueryInterface();
// await queryInterface.addIndex('Crontabs', ['command'], { unique: true });
// await queryInterface.addIndex('Envs', ['name', 'value'], { unique: true });
// await queryInterface.addIndex('Apps', ['name'], { unique: true });
// } catch (error) {
// }
const crondbExist = await fileExist(config.cronDbFile);
const dependenceDbExist = await fileExist(config.dependenceDbFile);
const envDbExist = await fileExist(config.envDbFile);