refactor channel

This commit is contained in:
Ren Amamiya
2023-06-17 12:28:46 +07:00
parent 0a6865431d
commit c9f7d942a0
21 changed files with 275 additions and 291 deletions

View File

@@ -18,25 +18,6 @@ VALUES
1681898574
);
INSERT
OR IGNORE INTO channels (
event_id,
pubkey,
name,
about,
picture,
created_at
)
VALUES
(
"42224859763652914db53052103f0b744df79dfc4efef7e950fc0802fc3df3c5",
"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c",
"Amethyst Users",
"General discussion about the Amethyst Nostr client for Android",
"https://nostr.build/i/5970.png",
1674092111
);
INSERT
OR IGNORE INTO channels (
event_id,

View File

@@ -0,0 +1,15 @@
-- Add migration script here
CREATE TABLE
channel_messages (
id INTEGER NOT NULL PRIMARY KEY,
channel_id TEXT NOT NULL,
event_id TEXT NOT NULL UNIQUE,
pubkey TEXT NOT NULL,
kind INTEGER NOT NULL,
content TEXT NOT NULL,
tags JSON,
mute BOOLEAN DEFAULT 0,
hide BOOLEAN DEFAULT 0,
created_at INTEGER NOT NULL,
FOREIGN KEY (channel_id) REFERENCES channels (event_id)
);

View File

@@ -93,6 +93,12 @@ fn main() {
sql: include_str!("../migrations/20230521092300_add_block_model.sql"),
kind: MigrationKind::Up,
},
Migration {
version: 20230617003135,
description: "add channel messages",
sql: include_str!("../migrations/20230617003135_add_channel_messages.sql"),
kind: MigrationKind::Up,
},
],
)
.build(),