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

invites table migration #532

Merged
merged 5 commits into from
Nov 8, 2023
Merged

Conversation

alishakawaguchi
Copy link
Contributor

@alishakawaguchi alishakawaguchi commented Nov 8, 2023

completes NEOS-291

Copy link

vercel bot commented Nov 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
neosync-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 4:11pm

@alishakawaguchi alishakawaguchi self-assigned this Nov 8, 2023
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #532 (077d77b) into main (3212105) will decrease coverage by 9.91%.
Report is 8 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #532      +/-   ##
==========================================
- Coverage   46.74%   36.84%   -9.91%     
==========================================
  Files          51       24      -27     
  Lines        4937     2467    -2470     
==========================================
- Hits         2308      909    -1399     
+ Misses       2370     1462     -908     
+ Partials      259       96     -163     

see 29 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@@ -14,4 +14,4 @@ SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)

# use epoch time so unlikely to clash
set -v
migrate create -ext sql -dir "${SCRIPT_DIR}/../migrations" "$1"
migrate create -ext sql -dir "${SCRIPT_DIR}/../sql/postgresql/schema" "$1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoop sorry, missed this ref update.

CONSTRAINT invites_pkey PRIMARY KEY (id),
CONSTRAINT fk_invites_accounts_id FOREIGN KEY (account_id) REFERENCES neosync_api.accounts(id) ON DELETE CASCADE,
CONSTRAINT fk_invites_users_id FOREIGN KEY (id) REFERENCES neosync_api.users(id) ON DELETE CASCADE,
CONSTRAINT invites_email_account_id UNIQUE (email, account_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we want this constraint. If an email gives invited but the invitation expires, they should be able to receive another invite without having to delete the previous one.

CREATE TABLE IF NOT EXISTS neosync_api.invites (
id uuid NOT NULL DEFAULT gen_random_uuid(),
account_id uuid NOT NULL,
sender_user_id uuid NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this should be NULL and the FK constraint should set to null if the user_id is deleted. That way a user could be removed, but the invite is retained.
Any thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense

Copy link
Member

@nickzelei nickzelei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@alishakawaguchi alishakawaguchi merged commit 1b26c70 into main Nov 8, 2023
7 of 8 checks passed
@alishakawaguchi alishakawaguchi deleted the alisha/neos-297-invite-migration branch November 8, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants