Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rename logs and metadata tables #677

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Conversation

darunrs
Copy link
Collaborator

@darunrs darunrs commented Apr 19, 2024

The logs and metadata tables were created with a __ prefix. Unfortunately, it turns out that the prefix is a reserved prefix used by Hasura. So, we are renaming the tables to be prefixed with sys_, which is not reserved, to the best of my knowledge.

The specific process for the migration is:

  1. Delete and recreate the cron DB in dev. This deletes the BD and any scheduled jobs.
  2. Delete logs/metadata tables and any created partitions.
  3. Create new tables.
  4. Use new tables successfully.

@darunrs
Copy link
Collaborator Author

darunrs commented Apr 19, 2024

Tested locally and was able to observe old tables/partitions deleted, new tables created, and new partition functions succeed.

@darunrs darunrs marked this pull request as ready for review April 19, 2024 18:29
@darunrs darunrs requested a review from a team as a code owner April 19, 2024 18:29
@darunrs
Copy link
Collaborator Author

darunrs commented Apr 19, 2024

Cron jobs deleted in database. Will deploy this PR now.

@darunrs darunrs merged commit 69332be into main Apr 19, 2024
3 checks passed
@darunrs darunrs deleted the rename-logs-metadata-tables branch April 19, 2024 21:45
await this.hasuraClient.untrackTables(indexerConfig.databaseName(), indexerConfig.schemaName(), tablesToDelete, true);
}
if (tableNames.includes(oldLogsTable)) {
await this.hasuraClient.executeSqlOnSchema(indexerConfig.databaseName(), indexerConfig.schemaName(), `DROP TABLE IF EXISTS ${oldLogsTable} CASCADE;`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this delete partitions too?

@darunrs darunrs linked an issue Apr 23, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to new logs and metadata tables
2 participants