feat: extracted

This commit is contained in:
Vlad Stan 2023-01-30 14:40:55 +02:00
parent 462770be40
commit 4b82905f78
12 changed files with 573 additions and 0 deletions

38
migrations.py Normal file
View file

@ -0,0 +1,38 @@
async def m001_initial(db):
"""
Initial nostrrelays tables.
"""
await db.execute(
"""
CREATE TABLE nostrrelay.relays (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
name TEXT NOT NULL
);
"""
)
await db.execute(
f"""
CREATE TABLE nostrrelay.events (
relay_id TEXT NOT NULL,
id TEXT PRIMARY KEY,
pubkey TEXT NOT NULL,
created_at {db.big_int} NOT NULL,
kind INT NOT NULL,
content TEXT NOT NULL,
sig TEXT NOT NULL
);
"""
)
await db.execute(
"""
CREATE TABLE nostrrelay.event_tags (
relay_id TEXT NOT NULL,
event_id TEXT NOT NULL,
name TEXT NOT NULL,
value TEXT NOT NULL
);
"""
)