Lukmanul Hakim
Lukmanul Hakim

Reputation: 1

Migration on Laravel Moduels

how to make migration with specific table ? I've tried it with the command

php artisan module:make-migration alter_table_product_prices_add_supplier_price --table=product_prices Product

OR

php artisan module:make-migration alter_table_product_prices_add_supplier_price Product --table=product_prices

but it's does not work

and how to rollback migration with step on laravel modules ? I've tried it with the command

php artisan module:migrate-rollback --step=1 Product

OR

php artisan module:migrate-rollback Product --step=1

it's also does not work

Upvotes: 0

Views: 864

Answers (2)

Aldi Azhar
Aldi Azhar

Reputation: 1

you need to write module like this --module=your_module.

php artisan module:make-migration add_group_commision_to_supplier_table --module=Supplier --table=suppliers

Upvotes: 0

KINGSLEY OKPARA
KINGSLEY OKPARA

Reputation: 559

if you have already created the table and you want to add/edit/delete a column

you can run this

php artisan make:migration add_column_name_to_product_prices_table

The important things to note there is

  1. product_prices is the name of the table,
  2. the to will tell laravel that you are trying to alter an existing table, so instead of the create method of the schema, it will bring the table method

This is a screenshot of what I did, and the migration file that laravel created for me enter image description here

Upvotes: 1

Related Questions