only create triggers when create new table

This commit is contained in:
Maidul Islam
2024-11-15 00:42:30 -07:00
parent 796f76da46
commit 8819abd710

View File

@@ -13,9 +13,9 @@ export async function up(knex: Knex): Promise<void> {
t.string("name").notNullable();
t.string("description").notNullable();
});
}
await createOnUpdateTrigger(knex, TableName.PkiCollection);
await createOnUpdateTrigger(knex, TableName.PkiCollection);
}
if (!(await knex.schema.hasTable(TableName.PkiCollectionItem))) {
await knex.schema.createTable(TableName.PkiCollectionItem, (t) => {
@@ -28,9 +28,9 @@ export async function up(knex: Knex): Promise<void> {
t.uuid("certId").nullable();
t.foreign("certId").references("id").inTable(TableName.Certificate).onDelete("CASCADE");
});
}
await createOnUpdateTrigger(knex, TableName.PkiCollectionItem);
await createOnUpdateTrigger(knex, TableName.PkiCollectionItem);
}
if (!(await knex.schema.hasTable(TableName.PkiAlert))) {
await knex.schema.createTable(TableName.PkiAlert, (t) => {
@@ -45,9 +45,9 @@ export async function up(knex: Knex): Promise<void> {
t.string("recipientEmails").notNullable();
t.unique(["name", "projectId"]);
});
}
await createOnUpdateTrigger(knex, TableName.PkiAlert);
await createOnUpdateTrigger(knex, TableName.PkiAlert);
}
}
export async function down(knex: Knex): Promise<void> {