-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(libs/db): initialize database schemas
- Loading branch information
Showing
11 changed files
with
142 additions
and
9 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
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,11 @@ | ||
import { boolean, pgEnum, pgTable, serial, varchar } from 'drizzle-orm/pg-core' | ||
|
||
export const relationshipEnum = pgEnum('relationship', ['mother', 'father', 'sibling', 'friend', 'relative', 'other']) | ||
|
||
export const emergencyContact = pgTable('emergencyContact', { | ||
id: serial('id').primaryKey(), | ||
name: varchar('name', { length: 32 }), | ||
relationship: relationshipEnum('relationship'), | ||
phoneNumber: varchar('phoneNumber', { length: 16 }).unique(), | ||
isPhoneNumberVerified: boolean('isPhoneNumberVerified').default(false), | ||
}) |
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
export * from './user' | ||
export * from './emergencyContact' | ||
export * from './program' | ||
export * from './resume' | ||
export * from './school' | ||
export * from './session' | ||
export * from './socialMedia' | ||
export * from './team' | ||
export * from './user' | ||
export * from './userPreferences' |
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,11 @@ | ||
import { integer, pgEnum, pgTable, serial, varchar } from 'drizzle-orm/pg-core' | ||
import { school } from './school' | ||
|
||
export const programTypeEnum = pgEnum('programType', ['bachelor', 'master', 'diploma', 'certificate']) | ||
|
||
export const program = pgTable('program', { | ||
id: serial('id').primaryKey(), | ||
name: varchar('name', { length: 128 }), | ||
schoolId: integer('schoolId').references(() => school.id), | ||
programType: programTypeEnum('programType'), | ||
}) |
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,8 @@ | ||
import { boolean, pgTable, serial, timestamp, varchar } from 'drizzle-orm/pg-core' | ||
|
||
export const resume = pgTable('resume', { | ||
id: serial('id').primaryKey(), | ||
fileLink: varchar('fileLink', { length: 128 }), | ||
hasPrivacyToggle: boolean('hasPrivacyToggle').default(false), | ||
uploadedAt: timestamp('uploadedAt').defaultNow(), | ||
}) |
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,9 @@ | ||
import { pgEnum, pgTable, serial, varchar } from 'drizzle-orm/pg-core' | ||
|
||
export const levelOfStudyEnum = pgEnum('levelOfStudy', ['graduateSchool', 'highSchool']) | ||
|
||
export const school = pgTable('school', { | ||
id: serial('id').primaryKey(), | ||
name: varchar('name', { length: 128 }), | ||
levelOfStudy: levelOfStudyEnum('levelOfStudy'), | ||
}) |
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
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,11 @@ | ||
import { integer, pgTable, serial, varchar } from 'drizzle-orm/pg-core' | ||
|
||
import { user } from './user' | ||
|
||
export const socialMedia = pgTable('socialMedia', { | ||
id: serial('id').primaryKey(), | ||
userId: integer('userId') | ||
.references(() => user.id), | ||
platformName: varchar('platformName', { length: 16 }), | ||
profileUrl: varchar('profileUrl', { length: 128 }), | ||
}) |
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,13 @@ | ||
import { boolean, integer, pgTable, serial, varchar } from 'drizzle-orm/pg-core' | ||
|
||
export const team = pgTable('team', { | ||
id: serial('id').primaryKey(), | ||
name: varchar('name', { length: 64 }), | ||
profileImageUrl: varchar('profileImageUrl', { length: 128 }), | ||
projectLinkUrl: varchar('projectLinkUrl', { length: 256 }), | ||
teamOwnerId: integer('teamOwnerId'), | ||
hasSubmitted: boolean('hasSubmitted').default(false), | ||
teamProfileImageUrl: varchar('teamProfileImageUrl', { | ||
length: 128, | ||
}), | ||
}) |
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 |
---|---|---|
@@ -1,8 +1,36 @@ | ||
import { pgTable, text } from 'drizzle-orm/pg-core' | ||
import { boolean, date, integer, pgEnum, pgTable, serial, smallint, text, varchar } from 'drizzle-orm/pg-core' | ||
import { resume } from './resume' | ||
import { school } from './school' | ||
import { emergencyContact } from './emergencyContact' | ||
import { team } from './team' | ||
|
||
export const genderEnum = pgEnum('gender', ['male', 'female', 'other']) | ||
export const phoneNumberCountryCodeEnum = pgEnum('phoneNumberCountryCode', ['+1']) | ||
export const ethnicityEnum = pgEnum('ethnicity', ['black', 'white', 'asian', 'hispanic', 'middle-eastern']) | ||
|
||
export const user = pgTable('user', { | ||
id: text('id').primaryKey(), | ||
name: text('name'), | ||
email: text('email').notNull(), | ||
avatarUrl: text('avatar_url'), | ||
id: serial('id').primaryKey(), | ||
firstName: varchar('firstName', { length: 32 }).notNull(), | ||
middleName: varchar('middleName', { length: 32 }), | ||
lastName: varchar('lastName', { length: 32 }).notNull(), | ||
preferredName: varchar('preferredName', { length: 32 }), | ||
email: varchar('email', { length: 64 }).unique().notNull(), | ||
isEmailVerified: boolean('isEmailVerified').default(false), | ||
avatarUrl: varchar('avatarUrl', { length: 128 }), | ||
profileDescription: text('profileDescription'), | ||
dateOfBirth: date('dateOfBirth'), | ||
gender: genderEnum('gender'), | ||
phoneNumberCountryCode: phoneNumberCountryCodeEnum('phoneNumberCountryCode'), | ||
phoneNumber: varchar('phoneNumber', { length: 16 }).unique(), | ||
isPhoneNumberVerified: boolean('isPhoneNumberVerified').default(false), | ||
numHackathonsAttended: smallint('numHackathonsAttended').default(0), | ||
anyOtherComments: text('anyOtherComments'), | ||
isDomestic: boolean('isDomestic'), | ||
ethnicity: ethnicityEnum('ethnicity'), | ||
estimatedGradYear: integer('estimatedGradYear'), | ||
agreeToMlhReqs: boolean('agreeToMlhReqs').default(false), | ||
resumeId: integer('resumeId').references(() => resume.id), | ||
schoolId: integer('schoolId').references(() => school.id), | ||
emergencyContactId: integer('emergencyContactId').references(() => emergencyContact.id), | ||
teamId: integer('teamId').references(() => team.id), | ||
}) |
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,28 @@ | ||
import { boolean, integer, pgEnum, pgTable, serial } from 'drizzle-orm/pg-core' | ||
import { user } from './user' | ||
|
||
export const preferredLanguageEnum = pgEnum('preferredLanguage', ['EN']) | ||
export const eventPreferencesEnum = pgEnum('eventPreferences', ['hardware', 'software']) | ||
export const shirtSizeEnum = pgEnum('shirtSize', ['XS', 'S', 'M', 'L', 'XL', 'XXL']) | ||
export const pronounsEnum = pgEnum('pronouns', ['he/him', 'she/her', 'they/them', 'other']) | ||
export const dietRestrictionsEnum = pgEnum('dietRestrictions', ['allergies', 'vegan', 'none']) | ||
export const trackPreferencesEnum = pgEnum('trackPreferences', ['hardware', 'software']) | ||
export const interestsEnum = pgEnum('interests', ['languages']) | ||
export const disabilitiesEnum = pgEnum('disabilities', ['mobility', 'visual', 'hearing', 'cognitive', 'mental']) | ||
export const applicableSkillsEnum = pgEnum('applicableSkills', ['JavaScript', 'TypeScript', 'Python', 'Java']) | ||
|
||
export const userPreferences = pgTable('userPreferences', { | ||
id: serial('id').primaryKey(), | ||
userId: integer('userId').references(() => user.id), | ||
preferredLanguage: preferredLanguageEnum('preferredLanguage').default('EN'), | ||
eventPreferences: eventPreferencesEnum('eventPreferences'), | ||
privacyMode: boolean('privacyMode').default(false), | ||
isSubscribedToNewsletter: boolean('isSubscribedToNewsletter').default(false), | ||
shirtSize: shirtSizeEnum('shirtSize'), | ||
pronouns: pronounsEnum('pronouns'), | ||
dietRestrictions: dietRestrictionsEnum('dietRestrictions').array(), | ||
trackPreferences: trackPreferencesEnum('trackPreferences').array(), | ||
interests: interestsEnum('interests').array(), | ||
disabilities: disabilitiesEnum('disabilities').array(), | ||
applicableSkills: applicableSkillsEnum('applicableSkills').array(), | ||
}) |