more hub persistency updates
This commit is contained in:
@@ -81,9 +81,40 @@ func Init(ctx context.Context) {
|
|||||||
creator UUID NOT NULL REFERENCES users(id),
|
creator UUID NOT NULL REFERENCES users(id),
|
||||||
join_role, // TODO set role uuid
|
join_role, // TODO set role uuid
|
||||||
rgba BIGINT NOT NULL DEFAULT 0 CHECK (rgba BETWEEN 0 AND 4294967295),
|
rgba BIGINT NOT NULL DEFAULT 0 CHECK (rgba BETWEEN 0 AND 4294967295),
|
||||||
user_color_allowed BOOLEAN DEAFAULT FALSE
|
user_color_allowed BOOLEAN DEAFAULT FALSE,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = dbConn.Exec(ctx, `
|
||||||
|
CREATE TABLE IF NOT EXISTS hub_roles (
|
||||||
|
id TINYINT PRIMARY KEY,
|
||||||
|
parent_id UUID NOT NULL REFERACES hubs(id) ON DELETE CASCADE
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
permissions INT NOT NULL DEFAULT 0,
|
||||||
|
rgba BIGINT NOT NULL DEFAULT 0 CHECK (rgba BETWEEN 0 AND 4294967295),
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
)
|
||||||
|
`)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = dbConn.Exec(ctx, `
|
||||||
|
CREATE TABLE IF NOT EXISTS hub_channel (
|
||||||
|
id TINYINT PRIMARY KEY,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
permissions INT NOT NULL DEFAULT 0,
|
||||||
|
rgba BIGINT NOT NULL DEFAULT 0 CHECK (rgba BETWEEN 0 AND 4294967295),
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
)
|
||||||
|
`)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UserSave(ctx context.Context, user *types.User) error {
|
func UserSave(ctx context.Context, user *types.User) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user