Jump to content

ENUM column type


jimfog

Recommended Posts

I am buliding a booking app and as such there is a table where bookings(it is appointments acually) are kept.

Regarding the bookings there are 2 cases:

 

  • The user makes a booking from the web app-the frontend, and
  • The admin makes a booking from the backend

Having said the above,,,,the booking table has a column named origin which keeps track from where each booking was closed,frontend or backend.

 

The question I want to make is what type this column must be.

 

What I have done is that I have created a second table.This table has 2 columns/rows only.VARCHAR and ENUM.Frontend has the value of 1 and backend the value 2.

 

The bookins table references this second table so as to distinguish the appointment from being made from the frontend vs the backend.

 

Does the above scheme sounds good to you.WHat do you think?

Do you think the second table is neccesary or I should try something else?

Link to comment
Share on other sites

I wouldn't use a second table for that, I would use an enum column in the first table.

Ok,that sounds good. I have to note somewhere though(even as simple comments) what each number will be associated with-1 for forntend for example,2 for backend.

 

I just saw that ENUM is of the string type...so I could just use "frontend" "backend".

Edited by jimfog
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...