Is this a good database structure?

The plan is to have user connted to teacher that is connected to School.

The reason is to have all the information on the teacher but also connect the teacher (list) to a school so they can work toghether.

Is this a bad workflow? How do i set this up in the workflow? Create account, create a new thing (Teacher) user = current user > create new thing (school) teacher = result of step 1 is all the way i have come so far, is it wrong?

But how do i connect Teacher with the school now when i have the school connected with the teacher? Am i thinking this through correctly?

Thankful for any help :slightly_smiling_face:

This is how I will build this:

School

  • School Name (Text)
  • Teacher (List of Teachers)
  • Student (List of Students)

Teacher

  • Name (Text)
  • School (School)
  • Student (List of Students)

Student

  • Name (Text)
  • Teacher (Teacher)
  • School (School)

With these structure, all your Tables are connected.

The lists are probably not a good idea given that schools could have hundreds of students and lists become incredibly inefficient very quickly. You don’t need a list of teachers on the school. If you want to display teachers for a given school, just Do a search for Teachers where School = X :slight_smile:

7 Likes

How would i connect these in a workflow?

Thank you, would you mind showing me a workflow? im having a hard time understanding the relations between databases…

I do not get it? Now i have

User:
Teacher

Teacher:
School
Full name
Phone

School:
Name
Adress
Logo
etc…

And when i tried to display it with “Current user Taechers Schools Name” It’s all blank on the teachers page? It does not seem to be linked? In the user they have a teacher conneted and that teacher is conneted to a School like i showed above?

A student is part of a school. A student also has a teacher. Therefore, a Student should have a School field and a Teacher field.

A teacher is part of a school. The Teacher should have a School field.

The School is part of nothing. The School does not need any additional fields to relate it to other data.

When you create a Student, set the Teacher and School field to the relevant Thing in your data base. Then, you can reference Student’s Teacher or Student’s School. Student’s School will be equal to Student’s Teacher’s School, but Student’s School is more efficient.

1 Like

I don’t understand where the student comes from haha, i never had a student it is a teacher platform so it’s User - Teacher - School

Then don’t include the student… it depends who uses your app… If students use your app, you need the Teacher and School field on the User…

1 Like

This is the current setup i have now.
I have checked the database and User is assigned to Teacher and Teacher is Assigned to a School in the database. When i try to display the school’s name it is blank, why? Are they linked or am i trying to display it wrong?

Current users Teachers Schools Name

Use the debugger. Your teacher is probably not assigned to the User at all… You need to set current user’s Teacher to the relevant teacher.

I seem to have figured it out (some how and i have no idea how, lol) now…

Something to consider. :face_with_monocle:

Can anyone sign up and assign themselves to a certain school? Or can a school admin only invite others to their school privately? It really depends on your application. This might be a part of your issue and you might not realize it if you just went to the database and attached a school to your teacher.

Does that make sense?

2 Likes

Hey, @Orbit! An interesting idea to consider is adding a ‘type’ column to your user table. This way, you can easily define different user types (such as students or school admins) and specify their permissions or access to certain data/pages.

For example, your main users might be teachers. When creating a new user, you can simply assign the ‘type’ as ‘teacher’.

To enhance efficiency, you can create an Option Set called ‘user_types’. The ‘type’ column on the user table would then be linked to this Option Set. This setup gives you better control when adding new user types.

Your user fields would look like this:

And your Option Set like this:

This might not apply to your specific case, but if it does, it could help streamline your database structure and application! Best of luck.

1 Like

Good question! The structure is for the school Admin to invite the teachers.
Thanks for the input :slight_smile:

1 Like

Hey @stela.vas, thanks for taking the time to do this detailed comment, i accualy just added it yesterday from a youtube video haha! It is very good idea, now in the workflow i also assign the “Role” Teacher to the user so i can keep track and also for permissions :slight_smile:

1 Like

That’s great! Yeah, this structure helps a lot, i’d say it’s a must have for applications that have different types of users. And no prob, my pelasure!

Have a good build!

This topic was automatically closed after 70 days. New replies are no longer allowed.