Laravel Delete Migration

Today, We want to share with you Laravel Delete Migration.In this post we will show you wordpress plugin require another plugin, hear for laravel 6 migration we will give you demo and example for implement.In this post, we will learn about how to delete migration and model in laravel with an example.

Laravel Delete Migration

There are the Following The simple About laravel create migration and model Full Information With Example and source code.

READ :  Woocommerce Product publish, update and delete hooks

As I will cover this Post with live Working example to develop Laravel – How to remove foreign key constraint using migration?, so the Adding & Removing column from existing database in Laravel usign migration is used for this example is following below.

How to delete a migration file in Laravel?

Phase 1:first of all simple create a Delete the migration file from app/database/migrations/ directory.

Phase 2:and then simple Run composer dump-autoload command to reset your autoload files.

Phase 3:after that you can Run migrate:rollback terminal to fire command to rollback the MySQL migration table from database.

Safely remove migration In Laravel

READ :  Responsive Bootstrap Cards Example

first of all Manually delete the migration file like path as a:

app/database/migrations/your_date_with_time_migration_file_name.php

and then Reset the composer autoload files: composer dump-autoload

Laravel – How to remove foreign key constraint using migration?

Wrong Column Migration:
[php]
Schema::create(‘products’, function (Blueprint $table) {
$table->increments(‘id’);
$table->string(‘product_name’);
$table->string(‘product_code’)->unique();
$table->string(‘product_varints_img_path’);
$table->string(‘sku’, 60);
$table->integer(‘product_id’)->unsigned();
$table->foreign(‘product_id’)->references(‘id’)->on(‘products’)->onDelete(‘cascade’);
$table->timestamps();
});
[/php]

Drop Column Migration:
[php]
Schema::table(‘products’, function (Blueprint $table) {
$table->dropForeign(‘user_product_id_foreign’);
$table->dropColumn(‘product_id’);
});
[/php]

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel migration change column type.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

READ :  Angular count array of total items in object

Leave a Reply

Your email address will not be published. Required fields are marked *