Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tasty-pigs-shine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ensnode/ensdb-sdk": minor
---

Introduced toolkit for managing ENSDb migrations for ENSNode Schema.
Comment thread
tk-o marked this conversation as resolved.
10 changes: 10 additions & 0 deletions packages/ensdb-sdk/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "drizzle-kit";

const ensNodeSchemaPath = "./src/ensnode/index.ts";

export default defineConfig({
casing: "snake_case",
dialect: "postgresql",
out: "migrations",
schema: ensNodeSchemaPath,
Comment thread
tk-o marked this conversation as resolved.
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE SCHEMA IF NOT EXISTS ensnode;

CREATE TABLE "ensnode"."metadata" (
"ens_indexer_schema_name" text NOT NULL,
"key" text NOT NULL,
"value" jsonb NOT NULL,
CONSTRAINT "metadata_pkey" PRIMARY KEY("ens_indexer_schema_name","key")
);
55 changes: 55 additions & 0 deletions packages/ensdb-sdk/migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"id": "d661dcae-f64d-4ecd-a4da-3d5783e17e2c",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"ensnode.metadata": {
"name": "metadata",
"schema": "ensnode",
"columns": {
"ens_indexer_schema_name": {
"name": "ens_indexer_schema_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"metadata_pkey": {
"name": "metadata_pkey",
"columns": ["ens_indexer_schema_name", "key"]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
13 changes: 13 additions & 0 deletions packages/ensdb-sdk/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1773743108514,
"tag": "0000_cultured_captain_cross",
"breakpoints": true
}
]
}
8 changes: 6 additions & 2 deletions packages/ensdb-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"./ensnode": "./src/ensnode/index.ts"
},
"files": [
"dist"
"dist",
"migrations",
"migrations/meta"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

likely not necessary to re-specify the /meta subpath

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice catch, will update this 👍

],
"publishConfig": {
"access": "public",
Expand Down Expand Up @@ -52,7 +54,8 @@
"scripts": {
"prepublish": "tsup",
"lint": "biome check --write .",
"lint:ci": "biome ci"
"lint:ci": "biome ci",
"drizzle-kit:generate": "drizzle-kit generate"
},
Comment thread
tk-o marked this conversation as resolved.
"peerDependencies": {
"drizzle-orm": "catalog:",
Expand All @@ -62,6 +65,7 @@
"devDependencies": {
"@ensnode/ensnode-sdk": "workspace:",
"@ensnode/shared-configs": "workspace:*",
"drizzle-kit": "0.31.10",
Comment thread
tk-o marked this conversation as resolved.
Comment thread
tk-o marked this conversation as resolved.
Comment thread
tk-o marked this conversation as resolved.
"drizzle-orm": "catalog:",
"ponder": "catalog:",
"tsup": "catalog:",
Expand Down
Loading
Loading