From bcc8811210696edd89047c4b16180640e053e819 Mon Sep 17 00:00:00 2001 From: Fernando Daciuk Date: Tue, 18 Jul 2023 19:46:54 -0300 Subject: [PATCH] fix: turn `github` and `email` unique in `User` model Other fixes: - Fix husky (add `commit-msg` back) - Fix seed of participants: add unique github usernames --- .husky/commit-msg | 4 + .husky/pre-commit | 1 - .../migration.sql | 6 ++ prisma/schema.prisma | 4 +- prisma/seed/participants.ts | 80 +++++++++---------- 5 files changed, 52 insertions(+), 43 deletions(-) create mode 100755 .husky/commit-msg rename prisma/migrations/{20230713222505_init => 20230718223230_init}/migration.sql (89%) diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..c160a77 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no -- commitlint --edit ${1} diff --git a/.husky/pre-commit b/.husky/pre-commit index fbe1020..75de8d8 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,5 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npx --no -- commitlint --edit ${1} yarn tsc yarn lint diff --git a/prisma/migrations/20230713222505_init/migration.sql b/prisma/migrations/20230718223230_init/migration.sql similarity index 89% rename from prisma/migrations/20230713222505_init/migration.sql rename to prisma/migrations/20230718223230_init/migration.sql index 7d0821a..fb6e3ab 100644 --- a/prisma/migrations/20230713222505_init/migration.sql +++ b/prisma/migrations/20230718223230_init/migration.sql @@ -38,3 +38,9 @@ CREATE UNIQUE INDEX "Event_name_key" ON "Event"("name"); -- CreateIndex CREATE UNIQUE INDEX "Event_slug_key" ON "Event"("slug"); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "User_github_key" ON "User"("github"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0c134cd..4523f1b 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -22,8 +22,8 @@ model Event { model User { id String @id @default(uuid()) name String - email String - github String + email String @unique + github String @unique createdAt DateTime @default(now()) updatedAt DateTime @updatedAt play Play[] diff --git a/prisma/seed/participants.ts b/prisma/seed/participants.ts index ffeee24..87a8838 100644 --- a/prisma/seed/participants.ts +++ b/prisma/seed/participants.ts @@ -8,201 +8,201 @@ export const participants: Participant[] = [ { name: "Eal Nottle", email: "enottle0@php.net", - github: "afpp3", + github: "enottle0", }, { name: "Sibyl Spence", email: "sspence1@surveymonkey.com", - github: "fdaciuk", + github: "sspence1", }, { name: "Shari Coan", email: "scoan2@hibu.com", - github: "afpp3", + github: "scoan2", }, { name: "Sheena Bend", email: "sbend3@blogger.com", - github: "fdaciuk", + github: "sbend3", }, { name: "Bartlet Boote", email: "bboote4@utexas.edu", - github: "afpp3", + github: "bboote4", }, { name: "Jourdan Kemson", email: "jkemson5@wikimedia.org", - github: "fdaciuk", + github: "jkemson5", }, { name: "Rudy McGoon", email: "rmcgoon6@walmart.com", - github: "afpp3", + github: "rmcgoon6", }, { name: "Katalin Grief", email: "kgrief7@techcrunch.com", - github: "fdaciuk", + github: "kgrief7", }, { name: "Tuckie Hartzenberg", email: "thartzenberg8@who.int", - github: "afpp3", + github: "thartzenberg8", }, { name: "Gabby Sivior", email: "gsivior9@slate.com", - github: "fdaciuk", + github: "gsivior9", }, { name: "Bliss Madgwich", email: "bmadgwicha@webmd.com", - github: "afpp3", + github: "bmadgwicha", }, { name: "Shaylah Wetherell", email: "swetherellb@forbes.com", - github: "fdaciuk", + github: "swetherellb", }, { name: "Barnie Chsteney", email: "bchsteneyc@wix.com", - github: "afpp3", + github: "bchsteneyc", }, { name: "Orlan Beamond", email: "obeamondd@businesswire.com", - github: "fdaciuk", + github: "obeamondd", }, { name: "Jacinta McKevin", email: "jmckevine@tripod.com", - github: "afpp3", + github: "jmckevine", }, { name: "Hasheem Teers", email: "hteersf@163.com", - github: "fdaciuk", + github: "hteersf", }, { name: "Wernher Grim", email: "wgrimg@jalbum.net", - github: "afpp3", + github: "wgrimg", }, { name: "Nelia Tambling", email: "ntamblingh@sciencedirect.com", - github: "fdaciuk", + github: "ntamblingh", }, { name: "Tore Cumberlidge", email: "tcumberlidgei@ed.gov", - github: "afpp3", + github: "tcumberlidgei", }, { name: "Carmelle Padson", email: "cpadsonj@cmu.edu", - github: "fdaciuk", + github: "cpadsonj", }, { name: "Prent Stannett", email: "pstannettk@vinaora.com", - github: "afpp3", + github: "pstannettk", }, { name: "Jennine Cundict", email: "jcundictl@last.fm", - github: "fdaciuk", + github: "jcundictl", }, { name: "Micaela Ebbotts", email: "mebbottsm@etsy.com", - github: "afpp3", + github: "mebbottsm", }, { name: "Case Wilsher", email: "cwilshern@seesaa.net", - github: "fdaciuk", + github: "cwilshern", }, { name: "Rubia Nielson", email: "rnielsono@ustream.tv", - github: "afpp3", + github: "rnielsono", }, { name: "Darn Agget", email: "daggetp@51.la", - github: "fdaciuk", + github: "daggetp", }, { name: "Lottie Gilligan", email: "lgilliganq@princeton.edu", - github: "afpp3", + github: "lgilliganq", }, { name: "Brucie Pollock", email: "bpollockr@shop-pro.jp", - github: "fdaciuk", + github: "bpollockr", }, { name: "Laina Cripin", email: "lcripins@dedecms.com", - github: "afpp3", + github: "lcripins", }, { name: "Garth Padmore", email: "gpadmoret@exblog.jp", - github: "fdaciuk", + github: "gpadmoret", }, { name: "Madlin Boler", email: "mboleru@microsoft.com", - github: "afpp3", + github: "mboleru", }, { name: "Timmy Cobden", email: "tcobdenv@360.cn", - github: "fdaciuk", + github: "tcobdenv", }, { name: "Ingaborg Ashfold", email: "iashfoldw@telegraph.co.uk", - github: "afpp3", + github: "iashfoldw", }, { name: "Mitzi Rollett", email: "mrollettx@ocn.ne.jp", - github: "fdaciuk", + github: "mrollettx", }, { name: "Keriann Spellworth", email: "kspellworthy@stumbleupon.com", - github: "afpp3", + github: "kspellworthy", }, { name: "Donovan Hucquart", email: "dhucquartz@github.com", - github: "fdaciuk", + github: "dhucquartz", }, { name: "Saba Klaassens", email: "sklaassens10@nytimes.com", - github: "afpp3", + github: "sklaassens10", }, { name: "Niki Penella", email: "npenella11@kickstarter.com", - github: "fdaciuk", + github: "npenella11", }, { name: "Gerda Moxsom", email: "gmoxsom12@guardian.co.uk", - github: "afpp3", + github: "gmoxsom12", }, { name: "Dion Jakubiak", email: "djakubiak13@prlog.org", - github: "fdaciuk", + github: "djakubiak13", }, ]