mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 06:34:57 +00:00
30 lines
835 B
TypeScript
30 lines
835 B
TypeScript
import { Knex } from "knex";
|
|
|
|
import { TableName } from "../schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
const hasConsecutiveFailedPasswordAttempts = await knex.schema.hasColumn(
|
|
TableName.Users,
|
|
"consecutiveFailedPasswordAttempts"
|
|
);
|
|
|
|
await knex.schema.alterTable(TableName.Users, (tb) => {
|
|
if (!hasConsecutiveFailedPasswordAttempts) {
|
|
tb.integer("consecutiveFailedPasswordAttempts").defaultTo(0);
|
|
}
|
|
});
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
const hasConsecutiveFailedPasswordAttempts = await knex.schema.hasColumn(
|
|
TableName.Users,
|
|
"consecutiveFailedPasswordAttempts"
|
|
);
|
|
|
|
await knex.schema.alterTable(TableName.Users, (tb) => {
|
|
if (hasConsecutiveFailedPasswordAttempts) {
|
|
tb.dropColumn("consecutiveFailedPasswordAttempts");
|
|
}
|
|
});
|
|
}
|