part of group messages history

This commit is contained in:
2026-04-12 14:39:24 +02:00
parent 3be9619cca
commit 09a6255213
4 changed files with 53 additions and 13 deletions
+12
View File
@@ -83,6 +83,16 @@ func DbInit(ctx context.Context) {
panic(err)
}
_, err = dbConn.Exec(ctx, `
CREATE TABLE IF NOT EXISTS chat_messages (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
sender_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
group_id UUID NOT NULL REFERENCES chat_groups(id) ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
content TEXT NOT NULL
)
`)
_, err = dbConn.Exec(ctx, `
CREATE TABLE IF NOT EXISTS chat_group_members (
group_id UUID NOT NULL REFERENCES chat_groups(id) ON DELETE CASCADE,
@@ -380,3 +390,5 @@ func DbGroupSetOwnerId(ctx context.Context, group *Group) error {
return err
}
DbGroup