Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add index for audit logs
Maidul Islam6af4b3f64c58
diff --git a/backend/src/db/migrations/20240522193447_index-audit-logs-project-id-org-id.ts b/backend/src/db/migrations/20240522193447_index-audit-logs-project-id-org-id.tsnew file mode 100644index 0000000000..7b208f0107--- /dev/null+++ b/backend/src/db/migrations/20240522193447_index-audit-logs-project-id-org-id.ts@@ -0,0 +1,26 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ const doesOrgIdExist = await knex.schema.hasColumn(TableName.AuditLog, "orgId");+ const doesProjectIdExist = await knex.schema.hasColumn(TableName.AuditLog, "projectId");+ if (await knex.schema.hasTable(TableName.AuditLog)) {+ await knex.schema.alterTable(TableName.AuditLog, (t) => {+ if (doesProjectIdExist) t.index("projectId");+ if (doesOrgIdExist) t.index("orgId");+ });+ }+}++export async function down(knex: Knex): Promise<void> {+ const doesOrgIdExist = await knex.schema.hasColumn(TableName.AuditLog, "orgId");+ const doesProjectIdExist = await knex.schema.hasColumn(TableName.AuditLog, "projectId");++ if (await knex.schema.hasTable(TableName.AuditLog)) {+ await knex.schema.alterTable(TableName.AuditLog, (t) => {+ if (doesProjectIdExist) t.dropIndex("projectId");+ if (doesOrgIdExist) t.dropIndex("orgId");+ });+ }+}