-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial spike on referrals service
extracted from original implementation in storacha/console#142
- Loading branch information
Showing
6 changed files
with
2,005 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- Migration number: 0001 2024-10-21T15:14:46.268Z | ||
|
||
-- users identified by email. each user has a refcode they can use to invite other users | ||
CREATE TABLE IF NOT EXISTS users ( | ||
email TEXT PRIMARY KEY, | ||
refcode TEXT UNIQUE | ||
); | ||
|
||
-- referrals identified by email. each referral tracks the refcode it was referred by. | ||
-- "reward" tracks whether the referee has paid long enough for the referrer to be rewarded | ||
CREATE TABLE IF NOT EXISTS referrals ( | ||
email TEXT PRIMARY KEY, | ||
refcode TEXT UNIQUE, | ||
referred_at DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
reward BOOLEAN, | ||
FOREIGN KEY(refcode) REFERENCES users(refcode) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.