Rework tables
This commit is contained in:
14
ddl.sql
14
ddl.sql
@@ -2,16 +2,26 @@ create table guild (
|
|||||||
id integer primary key,
|
id integer primary key,
|
||||||
name text
|
name text
|
||||||
);
|
);
|
||||||
|
create unique index idx_guild_name on guild(name);
|
||||||
|
|
||||||
create table stinky (
|
create table player (
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
name text,
|
name text,
|
||||||
guild integer references guild(id)
|
guild integer references guild(id)
|
||||||
);
|
);
|
||||||
|
create unique index idx_player_name on player(name);
|
||||||
|
|
||||||
|
create table association (
|
||||||
|
id integer primary key,
|
||||||
|
lhs integer references player(id),
|
||||||
|
rhs integer references player(id),
|
||||||
|
note text
|
||||||
|
);
|
||||||
|
|
||||||
create table note (
|
create table note (
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
content text,
|
content text,
|
||||||
timestamp string,
|
timestamp string,
|
||||||
stinky integer references stinky(id)
|
player integer references player(id)
|
||||||
);
|
);
|
||||||
|
create unique index idx_note_content on note(timestamp, player);
|
35
types.go
35
types.go
@@ -5,28 +5,35 @@ import "time"
|
|||||||
type (
|
type (
|
||||||
Guild struct {
|
Guild struct {
|
||||||
ID int
|
ID int
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
Player struct {
|
||||||
Stinky struct {
|
ID int
|
||||||
ID int
|
Name string `json:"name"`
|
||||||
Name string
|
Guild Guild `json:"guild"`
|
||||||
Guild Guild
|
}
|
||||||
|
Association struct {
|
||||||
|
ID int
|
||||||
|
LHS Player
|
||||||
|
RHS Player
|
||||||
|
Note string
|
||||||
}
|
}
|
||||||
|
|
||||||
Note struct {
|
Note struct {
|
||||||
ID int
|
ID int
|
||||||
Content string
|
Content string
|
||||||
Timestamp time.Time
|
Timestamp time.Time
|
||||||
Stinky Stinky
|
Player Player
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type NoteData struct {
|
type NoteData struct {
|
||||||
Player string
|
Player string
|
||||||
PlayerID int
|
Date time.Time
|
||||||
Date time.Time
|
Guild string
|
||||||
Guild string
|
Note string
|
||||||
GuildID int
|
Associations []NoteAssociationData
|
||||||
Note string
|
}
|
||||||
|
type NoteAssociationData struct {
|
||||||
|
Player string
|
||||||
|
Note string
|
||||||
}
|
}
|
Reference in New Issue
Block a user