Skip to content

Commit

Permalink
fix: Remove deletion of old logs and metadata tables (#679)
Browse files Browse the repository at this point in the history
All tables have been migrated to using the new tables. This code hook
for deleting old tables is no longer necessary.
  • Loading branch information
Darun Seethammagari authored Apr 20, 2024
1 parent c2f5f0d commit 1a877eb
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions runner/src/provisioner/provisioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,40 +255,12 @@ export default class Provisioner {
if (this.#hasLogsMetadataBeenProvisioned[indexerConfig.accountId]?.[indexerConfig.functionName]) {
return;
}
const oldLogsTable = '__logs';
const oldMetadataTable = '__metadata';
const logsTable = 'sys_logs';
const metadataTable = 'sys_metadata';

await wrapError(
async () => {
const tableNames = await this.getTableNames(indexerConfig.schemaName(), indexerConfig.databaseName());
if (tableNames.includes(oldLogsTable)) {
try {
await this.hasuraClient.untrackTables(indexerConfig.databaseName(), indexerConfig.schemaName(), [oldLogsTable], true);
} catch (err) {
const error = err as Error;
if (!error.message.includes('already untracked')) {
console.error(error.message);
}
}
}
if (tableNames.includes(oldMetadataTable)) {
try {
await this.hasuraClient.untrackTables(indexerConfig.databaseName(), indexerConfig.schemaName(), [oldMetadataTable], true);
} catch (err) {
const error = err as Error;
if (!error.message.includes('already untracked')) {
console.error(error.message);
}
}
}
if (tableNames.includes(oldLogsTable)) {
await this.hasuraClient.executeSqlOnSchema(indexerConfig.databaseName(), indexerConfig.schemaName(), `DROP TABLE IF EXISTS ${oldLogsTable} CASCADE;`);
}
if (tableNames.includes(oldMetadataTable)) {
await this.hasuraClient.executeSqlOnSchema(indexerConfig.databaseName(), indexerConfig.schemaName(), `DROP TABLE IF EXISTS ${oldMetadataTable};`);
}

if (!tableNames.includes(logsTable)) {
await this.setupPartitionedLogsTable(indexerConfig.userName(), indexerConfig.databaseName(), indexerConfig.schemaName());
Expand Down

0 comments on commit 1a877eb

Please sign in to comment.