Laravel

Migrations & Schema Builder

Migrations creation, schema builder, column types, indexes, foreign keys, rollbacks, seeders, factories

20 câu hỏi phỏng vấn·
Mid-Level
1

Which artisan command allows creating a new migration?

Câu trả lời

The make:migration command generates a new migration file in the database/migrations folder with an automatic timestamp. This command accepts a descriptive migration name and can use --create or --table options to automatically generate base code. Using this command ensures standardized structure and consistent naming of migrations.

2

Which Schema Builder method allows creating a new table?

Câu trả lời

The Schema::create() method allows creating a new table in the database. It takes two parameters: the table name and a closure that receives a Blueprint object to define columns. This method is used in the up() method of migrations to create new data structures.

3

Which column type should be used to store an auto-incrementing UNSIGNED BIGINT identifier?

Câu trả lời

The id() method creates an auto-incrementing UNSIGNED BIGINT column that serves as primary key. This is the recommended type for identifiers since Laravel 6, replacing increments(). This method automatically configures auto-increment and primary key constraint, simplifying table definition.

4

Which method allows adding created_at and updated_at columns to a table?

5

Which artisan command executes all pending migrations?

+17 câu hỏi phỏng vấn

Nắm vững Laravel cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí