I want to store HTML in the database as blob data type when I try to migrate getting errors
Schema::create('projects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('project_name');
$table->blob('project_description');
$table->timestamps();
});
}
php artisan module:migrate projects
Migrating: 2019_10_17_125423_create_projects_table
BadMethodCallException : Method Illuminate\Database\Schema\Blueprint::blob does not exist.
at xampp\htdocs\minidmsapi\vendor\laravel\framework\src\Illuminate\Support\Traits\Macroable.php:104
database\migration\add_new_column_to_products_table.php Now you can run migrate command to add this new field. Simply you can run below command to auto add a new field. Hope it can help you. Laravel Migration example tutorial, in this tutorial you have learned how to add new column to a table without losing data.
To rename a column, you may use the renameColumn method on the Schema builder. Before renaming a column, be sure to add the doctrine/dbal dependency to your composer. json file: Schema::table('users', function (Blueprint $table) { $table->renameColumn('from', 'to'); });
In Laravel
they have binary
instead of blob
. binary
is equivalent to blob
.
You can use it like:
$table->binary('name');
For more information see docs.
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With