-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Identity DB ready for prod #394
Changes from all commits
c970081
302b194
f3a7d12
9bcd0ad
9e3f588
df604ce
91797e7
d9c83de
b278dae
9f35c55
edaa59f
eb80645
e3bee27
d71659a
e36697a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
with-expecter: true | ||
packages: | ||
github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1: | ||
config: | ||
dir: ./pkg/mocks | ||
outpkg: mocks | ||
interfaces: | ||
MlsApi_SubscribeGroupMessagesServer: | ||
config: | ||
MlsApi_SubscribeWelcomeMessagesServer: | ||
config: | ||
github.com/xmtp/xmtp-node-go/pkg/mlsvalidate: | ||
config: | ||
dir: ./pkg/mocks | ||
outpkg: mocks | ||
interfaces: | ||
MLSValidationService: | ||
config: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ if ! which golangci-lint &>/dev/null; then brew install golangci-lint; fi | |
if ! which shellcheck &>/dev/null; then brew install shellcheck; fi | ||
if ! which protoc &>/dev/null; then brew install protobuf; fi | ||
if ! which protoc-gen-go &>/dev/null; then go install google.golang.org/protobuf/cmd/protoc-gen-go@latest; fi | ||
if ! which mockgen &>/dev/null || [ `mockgen --version` != "v0.4.0" ]; then go install go.uber.org/mock/[email protected]; fi | ||
if ! which mockery &>/dev/null; then brew install mockery; fi | ||
if ! which protolint &>/dev/null; then go install github.com/yoheimuta/protolint/cmd/protolint@latest; fi | ||
|
||
dev/generate | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
SET statement_timeout = 0; | ||
|
||
--bun:split | ||
DROP TABLE IF EXISTS messages; | ||
|
||
SELECT 1 | ||
|
||
--bun:split | ||
|
||
SELECT 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SET statement_timeout = 0; | ||
|
||
--bun:split | ||
DROP TABLE IF EXISTS installations, group_messages, welcome_messages, inbox_log, address_log; | ||
|
||
--bun:split | ||
DROP TYPE IF EXISTS inbox_filter; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
SET statement_timeout = 0; | ||
|
||
--bun:split | ||
DROP TYPE IF EXISTS inbox_filter; | ||
|
||
SELECT 1 | ||
|
||
--bun:split | ||
|
||
SELECT 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
SET statement_timeout = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I consolidated all our MLS schema into one big migration after the drops. Just easier to read this way |
||
|
||
--bun:split | ||
CREATE TABLE installations( | ||
id BYTEA PRIMARY KEY, | ||
created_at BIGINT NOT NULL, | ||
updated_at BIGINT NOT NULL, | ||
inbox_id BYTEA NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now store |
||
key_package BYTEA NOT NULL, | ||
expiration BIGINT NOT NULL | ||
); | ||
|
||
--bun:split | ||
CREATE TABLE group_messages( | ||
id BIGSERIAL PRIMARY KEY, | ||
created_at TIMESTAMP NOT NULL DEFAULT NOW(), | ||
group_id BYTEA NOT NULL, | ||
data BYTEA NOT NULL, | ||
group_id_data_hash BYTEA NOT NULL | ||
); | ||
|
||
--bun:split | ||
CREATE INDEX idx_group_messages_group_id_id ON group_messages(group_id, id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This index is different from before. We were previously indexing on |
||
|
||
--bun:split | ||
CREATE UNIQUE INDEX idx_group_messages_group_id_data_hash ON group_messages(group_id_data_hash); | ||
|
||
--bun:split | ||
CREATE TABLE welcome_messages( | ||
id BIGSERIAL PRIMARY KEY, | ||
created_at TIMESTAMP NOT NULL DEFAULT NOW(), | ||
installation_key BYTEA NOT NULL, | ||
data BYTEA NOT NULL, | ||
hpke_public_key BYTEA NOT NULL, | ||
installation_key_data_hash BYTEA NOT NULL | ||
); | ||
|
||
--bun:split | ||
CREATE INDEX idx_welcome_messages_installation_key_id ON welcome_messages(installation_key, id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also changed to match the sort/cursor field |
||
|
||
--bun:split | ||
CREATE UNIQUE INDEX idx_welcome_messages_group_key_data_hash ON welcome_messages(installation_key_data_hash); | ||
|
||
--bun:split | ||
CREATE TABLE inbox_log( | ||
sequence_id BIGSERIAL PRIMARY KEY, | ||
inbox_id BYTEA NOT NULL, | ||
neekolas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
server_timestamp_ns BIGINT NOT NULL, | ||
identity_update_proto BYTEA NOT NULL | ||
); | ||
|
||
--bun:split | ||
CREATE INDEX idx_inbox_log_inbox_id_sequence_id ON inbox_log(inbox_id, sequence_id); | ||
|
||
--bun:split | ||
CREATE TABLE address_log( | ||
address TEXT NOT NULL, | ||
inbox_id BYTEA NOT NULL, | ||
association_sequence_id BIGINT, | ||
revocation_sequence_id BIGINT | ||
); | ||
|
||
--bun:split | ||
CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); | ||
|
||
--bun:split | ||
CREATE TYPE inbox_filter AS ( | ||
inbox_id TEXT, -- Because this is serialized as JSON, we can't use a BYTEA type | ||
sequence_id BIGINT | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steven was previously using mockgen to generate mocks. I decided to switch us back to the more standard
testify/mock
andmockery
. It's more widely used and more actively maintained. Otherwise very similar, other than some syntax changes.This probably should have been a separate PR, but a lot of the things that were being mocked were also changing.