Skip to content

feat(db): add children and emergency_contacts tables with related fields#62

Open
achneerov wants to merge 2 commits intodevelopfrom
feature/60-child-registration-tables
Open

feat(db): add children and emergency_contacts tables with related fields#62
achneerov wants to merge 2 commits intodevelopfrom
feature/60-child-registration-tables

Conversation

@achneerov
Copy link
Copy Markdown

@achneerov achneerov commented May 3, 2026

Closes #60

Overview

Updating table

Testing

Visual inspection, did not want to actually apply the changes to the db to prevent regressions

Screenshots / Screencasts

n/a

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

Tip: You can make the issue and then check them after the fact or replace [ ] with [x] to check it!

Notes

There is a bit of an issue with the circular dependency between children and emergency contacts, however I think that the best approach is to ignore it for now and when you try to implement the adding children you will realize the issue and adjust your function accordingly, and at that point we can think about making a generalized function.

Comment thread lib/db/schema.ts
Comment on lines +176 to +185
export const extraQuestions = pgTable("extra_questions", {
id: uuid("id").primaryKey().defaultRandom(),
serviceId: uuid("service_id")
.references(() => services.id, { onDelete: "cascade" })
.notNull(),
type: extraQuestionTypeEnum("type").notNull(),
content: text("content").notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are storing the questions, but not the answers. Make a new extraQuestionsAnswers table.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I made a few changes, firstly I added ur table, but also to support multiple diff question types such as checkmark and radio boxes I made a new type that is an attribute in a question and it has an id. then if a user answers one of those checkbox or radio button questions we save a id or array of ids in "answer" in extraQuestionAnswers. otherwise we store a normal string array with one element string which is the answer

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