Skip to content

Commit

Permalink
export table names
Browse files Browse the repository at this point in the history
  • Loading branch information
karooolis committed Aug 19, 2024
1 parent 574e608 commit aa605da
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/store-sync/src/sqlite/internalTables.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
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" }),
// TODO: last block hash?
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(),
Expand All @@ -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);

0 comments on commit aa605da

Please sign in to comment.