Migrations and Seeders

Migrations, Seeders, and Factories

MySQL built the bookshop with hand-typed CREATE TABLE statements. A Laravel 2,157 project keeps the same schema as PHP classes under database/: migrations create and change tables, seeders fill them with reference and demo rows, and factories generate realistic fake models for seeders and tests. This section rebuilds all six bookshop tables that way on MySQL 9.7.2 524 , Laravel 13.33.0 and PHP 8.5.4. The database is shop, owned by an account shop_app with privileges on shop.* only, and .env (Environment Files) points at it with DB_CONNECTION=mysql, DB_HOST=127.0.0.1, DB_DATABASE=shop, DB_USERNAME=shop_app and its password.

Migration files, the migrations table, and the commands that move between them
Migration files, the migrations table, and the commands that move between them

Subsections