-
Notifications
You must be signed in to change notification settings - Fork 136
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ 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" |
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.
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) |
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.
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, |
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.
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?
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.
yeah that makes sense
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.
🚢
completes NEOS-291