0

I have got some problem with migration. I create new migrate file

php artisan make:migration create_menu_table --create=menu

then i edit the new Migration file and when i try migrate it's not working

I tried:

php artisan migrate
php artisan migrate --force
php artisan migrate:refresh
php artisan migrate:refresh --seed
php artisan migrate:rollback
php artisan migrate:reset

but they do not add created table

I do not have any errors

Thanks for help

Saad
  • 1,155
  • 3
  • 16
  • 36
Pionas
  • 346
  • 1
  • 4
  • 15
  • None of the artisan commands give you any errors? Do they give you any successful messages? – Saad Dec 15 '15 at 07:50
  • Did you choose your correct DB driver? – Mina Abadir Dec 15 '15 at 07:57
  • I do not have any errors. When i use `php artisan migrate:reset` they create only older tables – Pionas Dec 15 '15 at 08:02
  • So when you run `migrate` command, it creates only old tables? Are you sure it creates them, or they already exist so nothing actually happen. Would you please provide the command output after running it? – Mina Abadir Dec 15 '15 at 09:17
  • Yes, I'm sure because they clear all table... `php artisan migrate:refresh Rolled back: 2015_11_29_071555_create_articles_category_table Rolled back: 2015_11_27_100057_create_role_user_table Rolled back: 2015_11_27_100026_create_permission_role_table Rolled back: 2015_11_27_095944_create_permissions_table Rolled back: 2015_11_27_095845_create_roles_table Rolled back: 2014_10_12_100000_create_password_resets_table Rolled back: 2014_10_12_000000_create_users_table` when i use `php artisan migrate` nothing happens – Pionas Dec 15 '15 at 10:24
  • is it fresh laravel install or moving from one server to nexrt? – ujwal dhakal Dec 15 '15 at 10:57
  • Fresh install, i added some tools i.e: mcamara laravel-localization, bestmono filemanager, I created few models and controllers and that is all – Pionas Dec 15 '15 at 11:02

2 Answers2

1

Run composer dumpautoload and then try php artisan migrate:refresh again.

Hope this helps!

Rwd
  • 34,180
  • 6
  • 64
  • 78
  • The only other thing I can suggest if manually deleting your tables in your db and then running `php artisan migrate`. Also check that all of your migrations have a table name in their `up()` method i.e. `Schema::create('table-name',...'`. – Rwd Dec 15 '15 at 11:16
  • I just did it, and i had some problem with one table, i tried add index to text field... Now it works :) Thanks for help :) – Pionas Dec 15 '15 at 11:27
0

add schema ::defaultStringLength(191) to migrate file(put in every file migrate)

like this

public function up()
    {
        schema::defaultStringLength(191);
        Schema::create('products', function (Blueprint $table) {
            $table->increments('id');
            $table->string ('Name');
            $table->float('price');
            $table->timestamps();
        });
    }