Solved
1 views
How can you write a clean automated database migration script file inside a Laravel framework application architecture?
I want to add a new column named answer_author to an existing database table without losing or wiping clean my hundreds of active live question records. What command sequence creates the safe delta schema?
C
CodeCrafter
asked 5d ago · 10 rep
1 Answer(s)
0
Never drop and recreate active live database tables. Generate a specialized delta schema migration file using the terminal command: <code>php artisan make:migration add_answer_author_to_questions_table --table=questions</code>. Inside the generated up method append <code>$table->string('answer_author')->nullable();</code> then execute artisan migrate.
B
BladeExpert
answered 5d ago