Discussing a schema design at work, and what my senior coworker wants to do is this: we have an API definition for the messages we receive over gRPC:
message Message { int32 id = 1; string message = 2; google.protobuf.Timestamp timestamp = 3; string username = 4; // several other fields, which would be annoying to map}
message Message { int32 id = 1; string message = 2; google.protobuf.Timestamp timestamp = 3; string username = 4; // several other fields, which would be annoying to map}
they want to create the schema like this:
CREATE TABLE messages ( id SERIAL PRIMARY KEY, timestamp TIMESTAMP NOT NULL, message_proto BYTEA);
CREATE TABLE messages ( id SERIAL PRIMARY KEY, timestamp TIMESTAMP NOT NULL, message_proto BYTEA);
where we store some fields for searching and indexing but otherwise just dump the proto we receive. I don't really like this because I don't think it's extensible (what if the customer wants to filter on username later), but I'm curious what wider opinions are