part of group messages history
This commit is contained in:
+12
@@ -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
|
||||
Reference in New Issue
Block a user