Skip to content

Commit 748a198

Browse files
chore: add copy-cache command (#120)
# 🤖 Linear Merge after 1st reindex is done with strategyTiming cache ## Description ## Checklist before requesting a review - [ ] I have conducted a self-review of my code. - [ ] I have conducted a QA. - [ ] If it is a core feature, I have included comprehensive tests. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **Documentation** - Updated documentation to include the `strategy_timings` cache table in the blue-green database deployment process. - **Chores** - Added `strategy_timings` to the list of cache tables managed during migration operations. - Expanded tracked database tables in Hasura configuration to include `price_cache`. - Updated tests to reflect changes in tracked cache tables. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 840688d + 86b25c8 commit 748a198

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

scripts/hasura-config/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const tables = [
2929
"attestations",
3030
"attestation_txns",
3131
"events_registry",
32+
"price_cache",
3233
] as const;
3334

3435
type Tables = typeof tables;

scripts/migrations/README-DB-BLUE-GREEN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pnpm db:copy-cache -f blue
4343
### How Cache Data Copy Works
4444

4545
1. The script reads the PostgreSQL connection details from the `DATABASE_URL` environment variable
46-
2. It handles the two specific cache tables: `price_cache` and `metadata_cache`
46+
2. It handles the three specific cache tables: `price_cache`, `metadata_cache` and `strategy_timings`
4747
3. For each table:
4848
- It truncates the target table
4949
- Copies all data from the source to the target table
@@ -55,5 +55,6 @@ The script only copies the following tables, which contain cached data from exte
5555

5656
- `price_cache`: Stores token price information
5757
- `metadata_cache`: Stores token metadata
58+
- `strategy_timings`: Stores strategy timings (fetched from contract calls)
5859

5960
All other tables are managed through the regular migration process and are not part of the blue-green deployment cache copying strategy.

scripts/migrations/src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
export const BLUE_DB = "GitcoinDatalayerBlue";
77
export const GREEN_DB = "GitcoinDatalayerGreen";
88

9-
// These are the only two cache tables we need to handle
10-
export const CACHE_TABLES = ["price_cache", "metadata_cache"];
9+
// These are the only three cache tables we need to handle
10+
export const CACHE_TABLES = ["price_cache", "metadata_cache", "strategy_timings"];
1111

1212
/**
1313
* Interface for database connection details

tests/e2e/test/scenarios/baseSetup.spec-e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe("Base Setup", () => {
158158
// Verify unexpected types don't exist
159159
const unexpectedTypes = [
160160
"metadatacache",
161-
"pricecache",
161+
"strategy_timings",
162162
"processevents",
163163
"kyselymigration",
164164
"strategiesregistry",

0 commit comments

Comments
 (0)