Add group icon and privacy to the database schema

This commit is contained in:
Ske 2020-07-07 19:45:26 +02:00
parent 18cb6785e9
commit 9d5be07f0c
3 changed files with 24 additions and 1 deletions

View File

@ -1,11 +1,20 @@
-- SCHEMA VERSION 9: 2020-xx-xx --
-- Adds support for member groups.
create table groups (
id int primary key generated always as identity,
hid char(5) unique not null,
system int not null references systems(id) on delete cascade,
name text not null,
description text,
icon text,
-- Description columns follow the same pattern as usual: 1 = public, 2 = private
description_privacy integer check (description_privacy in (1, 2)) not null default 1,
icon_privacy integer check (icon_privacy in (1, 2)) not null default 1,
visibility integer check (visibility in (1, 2)) not null default 1,
created timestamp with time zone not null default (current_timestamp at time zone 'utc')
);

View File

@ -11,6 +11,11 @@ namespace PluralKit.Core
public string Name { get; } = null!;
public string? Description { get; }
public string? Icon { get; }
public PrivacyLevel DescriptionPrivacy { get; }
public PrivacyLevel IconPrivacy { get; }
public PrivacyLevel Visibility { get; }
public Instant Created { get; }
}

View File

@ -5,9 +5,18 @@ namespace PluralKit.Core
{
public Partial<string> Name { get; set; }
public Partial<string?> Description { get; set; }
public Partial<string?> Icon { get; set; }
public Partial<PrivacyLevel> DescriptionPrivacy { get; set; }
public Partial<PrivacyLevel> IconPrivacy { get; set; }
public Partial<PrivacyLevel> Visibility { get; set; }
public override UpdateQueryBuilder Apply(UpdateQueryBuilder b) => b
.With("name", Name)
.With("description", Description);
.With("description", Description)
.With("icon", Icon)
.With("description_privacy", DescriptionPrivacy)
.With("icon_privacy", IconPrivacy)
.With("visibility", Visibility);
}
}