0

I'm creating a laravel app and some tables will have status column that will receive just two values: ACTIVE or INACTIVE.

I think I have two options:

  1. boolean, normally set as tinyint(1) on MySql
  2. varchar, and set ACTIVE or INACTIVE strings values

The big question is which type should I choose:

  • The first one is smaller to storage on database, and if I set column name like is_active is easy to use in code, but will make database more difficult to ready by humans;

  • The second one will require more space to be saved in database and some class constants in model to make things more organized, but will make database more easy to read for humans (and new developers that could be added to project).

Which should I choose to have a good performance and readability?

Edit:

My question is about the difficulty / complexity to read / understand the database by developer if it needs to edit something directly in the database as opposed to the storage and performance question.

rhandrade
  • 1
  • 1

1 Answers1

1

You can choose either one. But if you really want to save space in your mysql you can use the tinyInt(1) then just use if condition to provide the readability for the user in your code. But if you only want readability for the developers just use comment and that will solve it.

Hope it helps!

Jovs
  • 852
  • 7
  • 23