I am trying to change column data type using laravel 5.6.
I have a table in which two columns have a data type of text
but I would like to change it to longtext
. I have tried following:
- executed
composer require doctrine/dbal
- executed
composer dump-autoload
...and then created the migration 2019_12_23_065820_change_response_column_data_type_in_log_requests_table.php
for log_requests
table.
...and then the following script
public function up()
{
Schema::table('log_requests', function (Blueprint $table) {
$table->longText('request')->nullable()->change();
$table->longText('response')->nullable()->change();
});
}
But it is not changing the column's data type. Can someone guide me? Where am I wrong so that I can fix it? Thank you.
EDITED
After requesting for migration in comment, I added migration script:
public function up()
{
Schema::create('log_requests', function (Blueprint $table) {
$table->increments('id');
$table->bigInteger('user_id')->nullable()->unsigned();
$table->string('api_name')->nullable();
$table->string('url')->nullable();
$table->string('method')->nullable();
$table->string('ip_address')->nullable();
$table->string('status_code')->nullable();
$table->string('duration')->nullable();
$table->text('request')->nullable();
$table->text('response')->nullable();
$table->timestamps();
});
}