From 574e6083e16b025e16eccbf72240c6af09f19e5b Mon Sep 17 00:00:00 2001 From: karooolis Date: Mon, 19 Aug 2024 13:31:21 +0300 Subject: [PATCH 1/2] export internal table names --- packages/store-sync/src/sqlite/internalTables.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/store-sync/src/sqlite/internalTables.ts b/packages/store-sync/src/sqlite/internalTables.ts index 6765e05646..c37eadc26f 100644 --- a/packages/store-sync/src/sqlite/internalTables.ts +++ b/packages/store-sync/src/sqlite/internalTables.ts @@ -2,7 +2,10 @@ import { blob, integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; import { address, asHex, json } from "./columnTypes"; import { PartialTable } from "./common"; -export const chainState = sqliteTable("__chainState", { +export const CHAIN_STATE_TABLE_NAME = "__chainState"; +export const MUD_STORE_TABLES_NAME = "__mudStoreTables"; + +export const chainState = sqliteTable(CHAIN_STATE_TABLE_NAME, { schemaVersion: integer("schema_version").notNull().primaryKey(), chainId: integer("chain_id").notNull().primaryKey(), lastUpdatedBlockNumber: blob("last_updated_block_number", { mode: "bigint" }), @@ -10,7 +13,7 @@ export const chainState = sqliteTable("__chainState", { lastError: text("last_error"), }); -export const mudStoreTables = sqliteTable("__mudStoreTables", { +export const mudStoreTables = sqliteTable(MUD_STORE_TABLES_NAME, { schemaVersion: integer("schema_version").primaryKey(), id: text("id").notNull().primaryKey(), address: address("address").notNull(), From aa605da404775c8675dca08368b7585b162992c6 Mon Sep 17 00:00:00 2001 From: karooolis Date: Mon, 19 Aug 2024 14:02:52 +0300 Subject: [PATCH 2/2] export table names --- packages/store-sync/src/sqlite/internalTables.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/store-sync/src/sqlite/internalTables.ts b/packages/store-sync/src/sqlite/internalTables.ts index c37eadc26f..3017ab8be2 100644 --- a/packages/store-sync/src/sqlite/internalTables.ts +++ b/packages/store-sync/src/sqlite/internalTables.ts @@ -1,11 +1,9 @@ +import { getTableName } from "drizzle-orm"; import { blob, integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; import { address, asHex, json } from "./columnTypes"; import { PartialTable } from "./common"; -export const CHAIN_STATE_TABLE_NAME = "__chainState"; -export const MUD_STORE_TABLES_NAME = "__mudStoreTables"; - -export const chainState = sqliteTable(CHAIN_STATE_TABLE_NAME, { +export const chainState = sqliteTable("__chainState", { schemaVersion: integer("schema_version").notNull().primaryKey(), chainId: integer("chain_id").notNull().primaryKey(), lastUpdatedBlockNumber: blob("last_updated_block_number", { mode: "bigint" }), @@ -13,7 +11,7 @@ export const chainState = sqliteTable(CHAIN_STATE_TABLE_NAME, { lastError: text("last_error"), }); -export const mudStoreTables = sqliteTable(MUD_STORE_TABLES_NAME, { +export const mudStoreTables = sqliteTable("__mudStoreTables", { schemaVersion: integer("schema_version").primaryKey(), id: text("id").notNull().primaryKey(), address: address("address").notNull(), @@ -26,3 +24,6 @@ export const mudStoreTables = sqliteTable(MUD_STORE_TABLES_NAME, { // TODO: last block hash? lastError: text("last_error"), }); + +export const internalTables = [chainState, mudStoreTables]; +export const internalTableNames = internalTables.map(getTableName);