Skip to content
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

adds account api key db migration #558

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions backend/gen/go/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS neosync_api.account_api_keys;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE IF NOT EXISTS neosync_api.account_api_keys (
id uuid NOT NULL DEFAULT gen_random_uuid(),
account_id uuid NOT NULL,

key_value text NOT NULL,

created_by_id uuid NOT NULL,
updated_By_id uuid NOT NULL,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
expires_at timestamp NOT NULL,

CONSTRAINT account_api_keys_pkey PRIMARY KEY (id),
CONSTRAINT account_api_keys_account_id_key_value UNIQUE(account_id, key_value),
CONSTRAINT fk_account_api_keys_accounts_id FOREIGN KEY (account_id) REFERENCES neosync_api.accounts(id) ON DELETE CASCADE,
CONSTRAINT fk_account_api_keys_created_by_id FOREIGN KEY (created_by_id) REFERENCES neosync_api.users(id),
CONSTRAINT fk_account_api_keys_updated_by_id FOREIGN KEY (updated_by_id) REFERENCES neosync_api.users(id)
);
ALTER TABLE neosync_api.account_api_keys OWNER TO neosync_api_owner;
GRANT ALL ON TABLE neosync_api.account_api_keys TO neosync_api_owner;
GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE neosync_api.account_api_keys TO neosync_api_readwrite;
GRANT SELECT ON TABLE neosync_api.account_api_keys TO neosync_api_readonly;
Loading