Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration wrong #42

Closed
gantoday opened this issue Feb 13, 2015 · 2 comments
Closed

migration wrong #42

gantoday opened this issue Feb 13, 2015 · 2 comments

Comments

@gantoday
Copy link

I'm run php artisan migrate in homestead,but something went wrong:

vagrant@homestead:~/code/test$ php artisan migrate --seed
Migration table created successfully.
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-464_134'' in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php:358
Stack trace:
#0 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(358): PDOStatement->execute(Array)
#1 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(606): Illuminate\Database\Connection->Illuminate\Database{closure}(Object(Illuminate\Database\MySqlConnection), 'alter table as...', Array) #2 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): Illuminate\Database\Connection->runQueryCallback('alter table as...', Array, Object(Closure))
#3 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(359): Illuminate\Database\Connection->run('alter table as...', Array, Object(Closure)) #4 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(63): Illuminate\Database\Connection->statement('alter table as...')
#5 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(169): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#6 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(112): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#7 /home/vagrant/code/test/storage/framework/compiled.php(5231): Illuminate\Database\Schema\Builder->create('assigned_roles', Object(Closure))
#8 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Facade::__callStatic('create', Array)
#9 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Schema::create('assigned_roles', Object(Closure))
#10 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(135): EntrustSetupTables->up()
#11 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(111): Illuminate\Database\Migrations\Migrator->runUp('2014_10_16_1151...', 1, false)
#12 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(82): Illuminate\Database\Migrations\Migrator->runMigrationList(Array, false)
#13 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(73): Illuminate\Database\Migrations\Migrator->run('/home/vagrant/c...', false)
#14 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#15 /home/vagrant/code/test/storage/framework/compiled.php(922): call_user_func_array(Array, Array)
#16 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#17 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /home/vagrant/code/test/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-464_134' (SQL: alter table assigned_roles add constraint assigned_roles_user_id_foreign foreign key (user_id) references users (id) on delete cascade)' in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php:614
Stack trace:
#0 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): Illuminate\Database\Connection->runQueryCallback('alter table as...', Array, Object(Closure)) #1 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(359): Illuminate\Database\Connection->run('alter table as...', Array, Object(Closure))
#2 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(63): Illuminate\Database\Connection->statement('alter table `as...')
#3 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(169): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#4 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(112): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#5 /home/vagrant/code/test/storage/framework/compiled.php(5231): Illuminate\Database\Schema\Builder->create('assigned_roles', Object(Closure))
#6 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Facade::__callStatic('create', Array)
#7 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Schema::create('assigned_roles', Object(Closure))
#8 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(135): EntrustSetupTables->up()
#9 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(111): Illuminate\Database\Migrations\Migrator->runUp('2014_10_16_1151...', 1, false)
#10 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(82): Illuminate\Database\Migrations\Migrator->runMigrationList(Array, false)
#11 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(73): Illuminate\Database\Migrations\Migrator->run('/home/vagrant/c...', false)
#12 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#13 /home/vagrant/code/test/storage/framework/compiled.php(922): call_user_func_array(Array, Array)
#14 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#15 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/vagrant/code/test/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 {main}

@stojankukrika
Copy link
Collaborator

TnX. Now it should work. I commit changes in migration files.

@gantoday
Copy link
Author

i'm sorry,but it still doesn't work
@stojankukrika

vagrant@homestead:~/code/test$ php artisan migrate
Migration table created successfully.
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-451_74'' in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php:358
Stack trace:
#0 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(358): PDOStatement->execute(Array)
#1 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(606): Illuminate\Database\Connection->Illuminate\Database{closure}(Object(Illuminate\Database\MySqlConnection), 'alter table st...', Array) #2 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): Illuminate\Database\Connection->runQueryCallback('alter tablest...', Array, Object(Closure))
#3 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(359): Illuminate\Database\Connection->run('alter table st...', Array, Object(Closure)) #4 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(63): Illuminate\Database\Connection->statement('alter tablest...')
#5 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(169): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#6 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(112): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#7 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(213): Illuminate\Database\Schema\Builder->create('assigned_roles', Object(Closure))
#8 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Facade::__callStatic('create', Array)
#9 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Schema::create('assigned_roles', Object(Closure))
#10 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(135): EntrustSetupTables->up()
#11 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(111): Illuminate\Database\Migrations\Migrator->runUp('2014_10_16_1151...', 1, false)
#12 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(82): Illuminate\Database\Migrations\Migrator->runMigrationList(Array, false)
#13 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(73): Illuminate\Database\Migrations\Migrator->run('/home/vagrant/c...', false)
#14 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#15 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#16 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#17 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /home/vagrant/code/test/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-451_74' (SQL: alter table start_assigned_roles add constraint assigned_roles_user_id_foreign foreign key (user_id) references start_users (id) on delete cascade)' in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php:614
Stack trace:
#0 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): Illuminate\Database\Connection->runQueryCallback('alter table st...', Array, Object(Closure)) #1 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php(359): Illuminate\Database\Connection->run('alter tablest...', Array, Object(Closure))
#2 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(63): Illuminate\Database\Connection->statement('alter table `st...')
#3 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(169): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#4 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(112): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#5 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(213): Illuminate\Database\Schema\Builder->create('assigned_roles', Object(Closure))
#6 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Facade::__callStatic('create', Array)
#7 /home/vagrant/code/test/database/migrations/2014_10_16_115128_entrust_setup_tables.php(34): Illuminate\Support\Facades\Schema::create('assigned_roles', Object(Closure))
#8 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(135): EntrustSetupTables->up()
#9 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(111): Illuminate\Database\Migrations\Migrator->runUp('2014_10_16_1151...', 1, false)
#10 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(82): Illuminate\Database\Migrations\Migrator->runMigrationList(Array, false)
#11 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(73): Illuminate\Database\Migrations\Migrator->run('/home/vagrant/c...', false)
#12 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#13 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#14 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#15 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/vagrant/code/test/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/vagrant/code/test/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 {main}

@zcosmin20 zcosmin20 mentioned this issue Dec 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants