Search code examples
laravelpagespeedlaravel-migrations

I don't use migrations in Laravel, is that a problem for server initial response time?


I simply don't use the migrations in Laravel. I just create the table from phpMyAdmin, and than I use php artisan to make a model. After that, I make the adjustments in the model file.

I know this shouldn't be done like that. But that's how I learned Laravel when I was an engineering student. Since no one correct me, I got used to it this way and continue.

My question is, if I used a database in that project, the server response time has more than 500ms delay. However, there is no such problem in projects where I do not use a database.

I think it's because I don't use migrations, but I'm not sure if it will affect it. Because, there are other frameworks that connect with the database and run on the same server. Their server response times also seem problematic.

I tried to create a project without database and with database using Laravel. Project that uses database have slower server inital response time nearly 500ms.

I'd like to know if this is happening because my server doesn't have enough resources or because I'm not using Laravel Migrations.

Here are some Pagespeed results;
Project i create with Laravel(No migration used): 820 ms
Project dont use database connection: 490 ms Project


Solution

  • That make sense. Connecting to DB, executing queries, getting data.. that takes some time.

    Project where data are hardcoded in the code (static websites) will be faster, compared to getting the data from DB.

    Migration is used only when executing php artisan migrate.

    Migration is kinds of like history of how you db structure expanded over time. Imagine working in teams and new developer will join the team, for local development, developer would just run the migration and all tables, relations, dummy data (seeds) will be created.