mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 04:26:43 +00:00
fix lint and short index name
This commit is contained in:
@@ -5,19 +5,20 @@ import { TableName } from "../schemas";
|
|||||||
const MIGRATION_TIMEOUT = 30 * 60 * 1000; // 30 minutes
|
const MIGRATION_TIMEOUT = 30 * 60 * 1000; // 30 minutes
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
const result = await knex.raw('SHOW statement_timeout');
|
const result = await knex.raw("SHOW statement_timeout");
|
||||||
const originalTimeout = result.rows[0].statement_timeout;
|
const originalTimeout = result.rows[0].statement_timeout;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await knex.raw(`SET statement_timeout = ${MIGRATION_TIMEOUT}`);
|
await knex.raw(`SET statement_timeout = ${MIGRATION_TIMEOUT}`);
|
||||||
|
|
||||||
|
// iat means IdentityAccessToken
|
||||||
await knex.raw(`
|
await knex.raw(`
|
||||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS ${TableName.IdentityAccessToken}_identityid_index
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_iat_identity_id
|
||||||
ON ${TableName.IdentityAccessToken} ("identityId")
|
ON ${TableName.IdentityAccessToken} ("identityId")
|
||||||
`);
|
`);
|
||||||
|
|
||||||
await knex.raw(`
|
await knex.raw(`
|
||||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS ${TableName.IdentityAccessToken}_identityuaclientsecretid_index
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_iat_ua_client_secret_id
|
||||||
ON ${TableName.IdentityAccessToken} ("identityUAClientSecretId")
|
ON ${TableName.IdentityAccessToken} ("identityUAClientSecretId")
|
||||||
`);
|
`);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -26,22 +27,22 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
const result = await knex.raw('SHOW statement_timeout');
|
const result = await knex.raw("SHOW statement_timeout");
|
||||||
const originalTimeout = result.rows[0].statement_timeout;
|
const originalTimeout = result.rows[0].statement_timeout;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await knex.raw(`SET statement_timeout = ${MIGRATION_TIMEOUT}`);
|
await knex.raw(`SET statement_timeout = ${MIGRATION_TIMEOUT}`);
|
||||||
|
|
||||||
await knex.raw(`
|
await knex.raw(`
|
||||||
DROP INDEX IF EXISTS ${TableName.IdentityAccessToken}_identityid_index
|
DROP INDEX IF EXISTS idx_iat_identity_id
|
||||||
`);
|
`);
|
||||||
|
|
||||||
await knex.raw(`
|
await knex.raw(`
|
||||||
DROP INDEX IF EXISTS ${TableName.IdentityAccessToken}_identityuaclientsecretid_index
|
DROP INDEX IF EXISTS idx_iat_ua_client_secret_id
|
||||||
`);
|
`);
|
||||||
} finally {
|
} finally {
|
||||||
await knex.raw(`SET statement_timeout = '${originalTimeout}'`);
|
await knex.raw(`SET statement_timeout = '${originalTimeout}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config = { transaction: false };
|
export const config = { transaction: false };
|
||||||
|
|||||||
Reference in New Issue
Block a user