Skip to content

Commit

Permalink
Better abstraction for message removal.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Apr 27, 2018
1 parent 91dc2c9 commit 194c11d
Show file tree
Hide file tree
Showing 9 changed files with 679 additions and 563 deletions.
488 changes: 239 additions & 249 deletions api/api.pb.go

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,12 @@ message ChannelMessage {
string username = 5;
// The content payload.
string content = 6;
// Another message ID reference, if any.
google.protobuf.StringValue reference_id = 7;
// The UNIX time when the message was created.
google.protobuf.Timestamp create_time = 8;
google.protobuf.Timestamp create_time = 7;
// The UNIX time when the message was last updated.
google.protobuf.Timestamp update_time = 9;
google.protobuf.Timestamp update_time = 8;
// True if the message was persisted to the channel's history, false otherwise.
google.protobuf.BoolValue persistent = 10;
google.protobuf.BoolValue persistent = 9;
}

// A list of channel messages, usually a result of a list operation.
Expand Down
4 changes: 0 additions & 4 deletions api/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1524,10 +1524,6 @@
"type": "string",
"description": "The content payload."
},
"reference_id": {
"type": "string",
"description": "Another message ID reference, if any."
},
"create_time": {
"type": "string",
"format": "date-time",
Expand Down
4 changes: 1 addition & 3 deletions migrate/sql/20180103142001_initial_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ CREATE INDEX IF NOT EXISTS collection_read_user_id_key_idx ON storage (collectio
CREATE TABLE IF NOT EXISTS message (
PRIMARY KEY (stream_mode, stream_subject, stream_descriptor, stream_label, create_time, id),
FOREIGN KEY (sender_id) REFERENCES users (id) ON DELETE CASCADE,
FOREIGN KEY (reference_id) REFERENCES message (id) ON DELETE CASCADE,

id UUID UNIQUE NOT NULL,
-- chat(0), chat_update(1), group_join(2), group_add(3), group_leave(4), group_kick(5), group_promoted(6)
-- chat(0), chat_update(1), chat_remove(2), group_join(3), group_add(4), group_leave(5), group_kick(6), group_promoted(7)
code SMALLINT DEFAULT 0 NOT NULL,
sender_id UUID NOT NULL,
username VARCHAR(128) NOT NULL,
Expand All @@ -116,7 +115,6 @@ CREATE TABLE IF NOT EXISTS message (
stream_descriptor UUID NOT NULL,
stream_label VARCHAR(128) NOT NULL,
content JSONB DEFAULT '{}' NOT NULL,
reference_id UUID,
create_time TIMESTAMPTZ DEFAULT now() NOT NULL,
update_time TIMESTAMPTZ DEFAULT now() NOT NULL,

Expand Down
Loading

0 comments on commit 194c11d

Please sign in to comment.