mirror of
https://github.com/aljazceru/mcp-code.git
synced 2025-12-17 20:55:10 +01:00
initial commit
This commit is contained in:
21
migrations/001-create-wot-table.ts
Normal file
21
migrations/001-create-wot-table.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { Database } from "bun:sqlite";
|
||||
|
||||
export const up = async (db: Database) => {
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS wot (
|
||||
follower TEXT NOT NULL,
|
||||
followed TEXT NOT NULL,
|
||||
PRIMARY KEY (follower, followed)
|
||||
)
|
||||
`);
|
||||
|
||||
// Create index for faster lookup by followed pubkey
|
||||
db.run(`
|
||||
CREATE INDEX IF NOT EXISTS idx_wot_followed
|
||||
ON wot (followed)
|
||||
`);
|
||||
};
|
||||
|
||||
export const down = async (db: Database) => {
|
||||
db.run("DROP TABLE IF EXISTS wot");
|
||||
};
|
||||
17
migrations/002-create-profiles-table.ts
Normal file
17
migrations/002-create-profiles-table.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Database } from "bun:sqlite";
|
||||
|
||||
export const up = async (db: Database) => {
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS profiles (
|
||||
pubkey TEXT PRIMARY KEY,
|
||||
profile TEXT NOT NULL,
|
||||
data TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`);
|
||||
};
|
||||
|
||||
export const down = async (db: Database) => {
|
||||
db.run("DROP TABLE IF EXISTS profiles");
|
||||
};
|
||||
Reference in New Issue
Block a user