Artisan 'Nothing to rollback' when there is a table already created
I wanted to make a migration using php artisan migrate but I got an error:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
So naturally I wanted to drop my tables using php artisan migrate:rollback, but I got:
Nothing to rollback.
What the heck? It said just earlier that the users table was already created. What should I do? I can delete the table with phpmyadmin but I want to learn how to use artisan.
Thank you for your help.
laravel artisan
add a comment |
I wanted to make a migration using php artisan migrate but I got an error:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
So naturally I wanted to drop my tables using php artisan migrate:rollback, but I got:
Nothing to rollback.
What the heck? It said just earlier that the users table was already created. What should I do? I can delete the table with phpmyadmin but I want to learn how to use artisan.
Thank you for your help.
laravel artisan
What if you usephp artisan migrate:resetinstead?
– Troyer
Apr 23 '18 at 14:35
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output ofphp artisan migrate:status? Do you see any migrations in themigrationstable from the database? If so, are those migrations what are you expecting them to be?
– Bogdan
Apr 23 '18 at 14:39
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make aphp artisan migrate:rollbackin the first place, I addedSchema::defaultStringLength(191);in AppServiceProvider. Now it seems to work well.
– JacopoStanchi
Apr 23 '18 at 14:48
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04
add a comment |
I wanted to make a migration using php artisan migrate but I got an error:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
So naturally I wanted to drop my tables using php artisan migrate:rollback, but I got:
Nothing to rollback.
What the heck? It said just earlier that the users table was already created. What should I do? I can delete the table with phpmyadmin but I want to learn how to use artisan.
Thank you for your help.
laravel artisan
I wanted to make a migration using php artisan migrate but I got an error:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
So naturally I wanted to drop my tables using php artisan migrate:rollback, but I got:
Nothing to rollback.
What the heck? It said just earlier that the users table was already created. What should I do? I can delete the table with phpmyadmin but I want to learn how to use artisan.
Thank you for your help.
laravel artisan
laravel artisan
edited Apr 24 '18 at 9:40
JacopoStanchi
asked Apr 23 '18 at 14:26
JacopoStanchiJacopoStanchi
41014
41014
What if you usephp artisan migrate:resetinstead?
– Troyer
Apr 23 '18 at 14:35
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output ofphp artisan migrate:status? Do you see any migrations in themigrationstable from the database? If so, are those migrations what are you expecting them to be?
– Bogdan
Apr 23 '18 at 14:39
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make aphp artisan migrate:rollbackin the first place, I addedSchema::defaultStringLength(191);in AppServiceProvider. Now it seems to work well.
– JacopoStanchi
Apr 23 '18 at 14:48
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04
add a comment |
What if you usephp artisan migrate:resetinstead?
– Troyer
Apr 23 '18 at 14:35
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output ofphp artisan migrate:status? Do you see any migrations in themigrationstable from the database? If so, are those migrations what are you expecting them to be?
– Bogdan
Apr 23 '18 at 14:39
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make aphp artisan migrate:rollbackin the first place, I addedSchema::defaultStringLength(191);in AppServiceProvider. Now it seems to work well.
– JacopoStanchi
Apr 23 '18 at 14:48
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04
What if you use
php artisan migrate:reset instead?– Troyer
Apr 23 '18 at 14:35
What if you use
php artisan migrate:reset instead?– Troyer
Apr 23 '18 at 14:35
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output of
php artisan migrate:status? Do you see any migrations in the migrations table from the database? If so, are those migrations what are you expecting them to be?– Bogdan
Apr 23 '18 at 14:39
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output of
php artisan migrate:status? Do you see any migrations in the migrations table from the database? If so, are those migrations what are you expecting them to be?– Bogdan
Apr 23 '18 at 14:39
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make a
php artisan migrate:rollback in the first place, I added Schema::defaultStringLength(191); in AppServiceProvider. Now it seems to work well.– JacopoStanchi
Apr 23 '18 at 14:48
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make a
php artisan migrate:rollback in the first place, I added Schema::defaultStringLength(191); in AppServiceProvider. Now it seems to work well.– JacopoStanchi
Apr 23 '18 at 14:48
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04
add a comment |
3 Answers
3
active
oldest
votes
Failing an answer to how to delete the tables with artisan when there is this problem, I will tell you how to avoid this problem in the first place. Ultimately I just deleted the tables using phpmyadmin.
I watched a tutorial on Laravel and I saw that in order to avoid the error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I had to add use IlluminateSupportFacadesSchema; in AppServiceProvider.php and Schema::defaultStringLength(191); in the boot() function. But I thought that I could put any number in defaultStringLength(...) so I put 255, and the migration didn't work.
Do as it is told in the tutorials, write Schema::defaultStringLength(191);. Then, you can execute your migration using php artisan migrate and it should work properly.
add a comment |
In my case after defining Schema::defaultStringLength(191); in the boot() method didn't solved. Because the migrations table in the database is empty.
So the solution is open up the tinker from the composer
$ php artisan tinker
>>> Schema::drop('users')
>>> Schema::drop('password_resets')
>>> Schema::drop('orders')
>>> exit
php artisan migrate
Here is the result of the above commands executed
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
In Connection.php line 647:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
already exists (SQL: create tableusers(idint unsigned not
null auto_incr ement primary key,namevarchar(255) not null,
passwordvarchar(255) not null,
remember_tokenvarchar(100) null,created_attimestamp null,
updated_attimestamp null) default character set utf8mb4
collate utf8mb4_unicode_ci)
In Connection.php line 449:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
alre ady exists
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate:rollback
Nothing to rollback.
nishanth@localhost:~/Desktop/html/hutch$ php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.20-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> Schema::drop('users')
=> null
>>> Schema::drop('password_resets')
=> null
>>> Schema::drop('orders')
=> null
>>> exit
Exit: Goodbye.
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_18_071213_create_orders_table
Migrated: 2018_08_18_071213_create_orders_table
nishanth@localhost:~/Desktop/html/hutch$
Also define the method down(), if it doesn't exist.
Otherwise, it'll show
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'XYZ.ABC' (SQL: drop table
ABC)
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ABC');
}
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because mymigrationstable was empty.
– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
add a comment |
SOLUTION:
>> php artisan migrate:fresh
It will drop all tables and recreates all the migrations.
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we usedefaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.
– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49983605%2fartisan-nothing-to-rollback-when-there-is-a-table-already-created%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Failing an answer to how to delete the tables with artisan when there is this problem, I will tell you how to avoid this problem in the first place. Ultimately I just deleted the tables using phpmyadmin.
I watched a tutorial on Laravel and I saw that in order to avoid the error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I had to add use IlluminateSupportFacadesSchema; in AppServiceProvider.php and Schema::defaultStringLength(191); in the boot() function. But I thought that I could put any number in defaultStringLength(...) so I put 255, and the migration didn't work.
Do as it is told in the tutorials, write Schema::defaultStringLength(191);. Then, you can execute your migration using php artisan migrate and it should work properly.
add a comment |
Failing an answer to how to delete the tables with artisan when there is this problem, I will tell you how to avoid this problem in the first place. Ultimately I just deleted the tables using phpmyadmin.
I watched a tutorial on Laravel and I saw that in order to avoid the error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I had to add use IlluminateSupportFacadesSchema; in AppServiceProvider.php and Schema::defaultStringLength(191); in the boot() function. But I thought that I could put any number in defaultStringLength(...) so I put 255, and the migration didn't work.
Do as it is told in the tutorials, write Schema::defaultStringLength(191);. Then, you can execute your migration using php artisan migrate and it should work properly.
add a comment |
Failing an answer to how to delete the tables with artisan when there is this problem, I will tell you how to avoid this problem in the first place. Ultimately I just deleted the tables using phpmyadmin.
I watched a tutorial on Laravel and I saw that in order to avoid the error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I had to add use IlluminateSupportFacadesSchema; in AppServiceProvider.php and Schema::defaultStringLength(191); in the boot() function. But I thought that I could put any number in defaultStringLength(...) so I put 255, and the migration didn't work.
Do as it is told in the tutorials, write Schema::defaultStringLength(191);. Then, you can execute your migration using php artisan migrate and it should work properly.
Failing an answer to how to delete the tables with artisan when there is this problem, I will tell you how to avoid this problem in the first place. Ultimately I just deleted the tables using phpmyadmin.
I watched a tutorial on Laravel and I saw that in order to avoid the error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I had to add use IlluminateSupportFacadesSchema; in AppServiceProvider.php and Schema::defaultStringLength(191); in the boot() function. But I thought that I could put any number in defaultStringLength(...) so I put 255, and the migration didn't work.
Do as it is told in the tutorials, write Schema::defaultStringLength(191);. Then, you can execute your migration using php artisan migrate and it should work properly.
edited Apr 23 '18 at 15:12
answered Apr 23 '18 at 15:03
JacopoStanchiJacopoStanchi
41014
41014
add a comment |
add a comment |
In my case after defining Schema::defaultStringLength(191); in the boot() method didn't solved. Because the migrations table in the database is empty.
So the solution is open up the tinker from the composer
$ php artisan tinker
>>> Schema::drop('users')
>>> Schema::drop('password_resets')
>>> Schema::drop('orders')
>>> exit
php artisan migrate
Here is the result of the above commands executed
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
In Connection.php line 647:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
already exists (SQL: create tableusers(idint unsigned not
null auto_incr ement primary key,namevarchar(255) not null,
passwordvarchar(255) not null,
remember_tokenvarchar(100) null,created_attimestamp null,
updated_attimestamp null) default character set utf8mb4
collate utf8mb4_unicode_ci)
In Connection.php line 449:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
alre ady exists
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate:rollback
Nothing to rollback.
nishanth@localhost:~/Desktop/html/hutch$ php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.20-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> Schema::drop('users')
=> null
>>> Schema::drop('password_resets')
=> null
>>> Schema::drop('orders')
=> null
>>> exit
Exit: Goodbye.
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_18_071213_create_orders_table
Migrated: 2018_08_18_071213_create_orders_table
nishanth@localhost:~/Desktop/html/hutch$
Also define the method down(), if it doesn't exist.
Otherwise, it'll show
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'XYZ.ABC' (SQL: drop table
ABC)
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ABC');
}
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because mymigrationstable was empty.
– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
add a comment |
In my case after defining Schema::defaultStringLength(191); in the boot() method didn't solved. Because the migrations table in the database is empty.
So the solution is open up the tinker from the composer
$ php artisan tinker
>>> Schema::drop('users')
>>> Schema::drop('password_resets')
>>> Schema::drop('orders')
>>> exit
php artisan migrate
Here is the result of the above commands executed
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
In Connection.php line 647:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
already exists (SQL: create tableusers(idint unsigned not
null auto_incr ement primary key,namevarchar(255) not null,
passwordvarchar(255) not null,
remember_tokenvarchar(100) null,created_attimestamp null,
updated_attimestamp null) default character set utf8mb4
collate utf8mb4_unicode_ci)
In Connection.php line 449:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
alre ady exists
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate:rollback
Nothing to rollback.
nishanth@localhost:~/Desktop/html/hutch$ php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.20-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> Schema::drop('users')
=> null
>>> Schema::drop('password_resets')
=> null
>>> Schema::drop('orders')
=> null
>>> exit
Exit: Goodbye.
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_18_071213_create_orders_table
Migrated: 2018_08_18_071213_create_orders_table
nishanth@localhost:~/Desktop/html/hutch$
Also define the method down(), if it doesn't exist.
Otherwise, it'll show
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'XYZ.ABC' (SQL: drop table
ABC)
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ABC');
}
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because mymigrationstable was empty.
– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
add a comment |
In my case after defining Schema::defaultStringLength(191); in the boot() method didn't solved. Because the migrations table in the database is empty.
So the solution is open up the tinker from the composer
$ php artisan tinker
>>> Schema::drop('users')
>>> Schema::drop('password_resets')
>>> Schema::drop('orders')
>>> exit
php artisan migrate
Here is the result of the above commands executed
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
In Connection.php line 647:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
already exists (SQL: create tableusers(idint unsigned not
null auto_incr ement primary key,namevarchar(255) not null,
passwordvarchar(255) not null,
remember_tokenvarchar(100) null,created_attimestamp null,
updated_attimestamp null) default character set utf8mb4
collate utf8mb4_unicode_ci)
In Connection.php line 449:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
alre ady exists
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate:rollback
Nothing to rollback.
nishanth@localhost:~/Desktop/html/hutch$ php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.20-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> Schema::drop('users')
=> null
>>> Schema::drop('password_resets')
=> null
>>> Schema::drop('orders')
=> null
>>> exit
Exit: Goodbye.
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_18_071213_create_orders_table
Migrated: 2018_08_18_071213_create_orders_table
nishanth@localhost:~/Desktop/html/hutch$
Also define the method down(), if it doesn't exist.
Otherwise, it'll show
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'XYZ.ABC' (SQL: drop table
ABC)
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ABC');
}
In my case after defining Schema::defaultStringLength(191); in the boot() method didn't solved. Because the migrations table in the database is empty.
So the solution is open up the tinker from the composer
$ php artisan tinker
>>> Schema::drop('users')
>>> Schema::drop('password_resets')
>>> Schema::drop('orders')
>>> exit
php artisan migrate
Here is the result of the above commands executed
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
In Connection.php line 647:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
already exists (SQL: create tableusers(idint unsigned not
null auto_incr ement primary key,namevarchar(255) not null,
passwordvarchar(255) not null,
remember_tokenvarchar(100) null,created_attimestamp null,
updated_attimestamp null) default character set utf8mb4
collate utf8mb4_unicode_ci)
In Connection.php line 449:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users'
alre ady exists
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate:rollback
Nothing to rollback.
nishanth@localhost:~/Desktop/html/hutch$ php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.20-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> Schema::drop('users')
=> null
>>> Schema::drop('password_resets')
=> null
>>> Schema::drop('orders')
=> null
>>> exit
Exit: Goodbye.
nishanth@localhost:~/Desktop/html/hutch$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_18_071213_create_orders_table
Migrated: 2018_08_18_071213_create_orders_table
nishanth@localhost:~/Desktop/html/hutch$
Also define the method down(), if it doesn't exist.
Otherwise, it'll show
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'XYZ.ABC' (SQL: drop table
ABC)
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ABC');
}
edited Aug 20 '18 at 16:44
answered Aug 20 '18 at 4:57
Nishanth ॐNishanth ॐ
5703621
5703621
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because mymigrationstable was empty.
– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
add a comment |
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because mymigrationstable was empty.
– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because my
migrations table was empty.– JacopoStanchi
Aug 20 '18 at 14:08
Beware, Tkinter and Tinker are not the same thing XD But you're right though, it was because my
migrations table was empty.– JacopoStanchi
Aug 20 '18 at 14:08
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
Thanks for correcting @JacopoStanchi
– Nishanth ॐ
Aug 20 '18 at 16:45
add a comment |
SOLUTION:
>> php artisan migrate:fresh
It will drop all tables and recreates all the migrations.
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we usedefaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.
– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
add a comment |
SOLUTION:
>> php artisan migrate:fresh
It will drop all tables and recreates all the migrations.
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we usedefaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.
– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
add a comment |
SOLUTION:
>> php artisan migrate:fresh
It will drop all tables and recreates all the migrations.
SOLUTION:
>> php artisan migrate:fresh
It will drop all tables and recreates all the migrations.
answered Jan 19 at 8:51
Naveen Kumar VNaveen Kumar V
568722
568722
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we usedefaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.
– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
add a comment |
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we usedefaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.
– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
1
1
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we use
defaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.– JacopoStanchi
Jan 19 at 12:12
Your answer is good if we just want to delete the tables, but we must also correct the problem of the table that is created by Artisan but that does not appear in the migration table when we use
defaultStringLength(255). I don't know if it's a bug of Artisan but that's the core problem.– JacopoStanchi
Jan 19 at 12:12
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
I am not sure if you are concerned about this issue too. stackoverflow.com/a/54265587/5276297
– Naveen Kumar V
Jan 19 at 12:19
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49983605%2fartisan-nothing-to-rollback-when-there-is-a-table-already-created%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What if you use
php artisan migrate:resetinstead?– Troyer
Apr 23 '18 at 14:35
You can only rollback the last migration executed. Is there any last migration that can be rolled back? What is the output of
php artisan migrate:status? Do you see any migrations in themigrationstable from the database? If so, are those migrations what are you expecting them to be?– Bogdan
Apr 23 '18 at 14:39
Sorry, Stack Overflow was on maintenance for a couple of minutes and I tried to manage it myself. What I did is delete all the tables (even the migration one) using phpmyadmin, and then I fixed what caused the fact that I had to make a
php artisan migrate:rollbackin the first place, I addedSchema::defaultStringLength(191);in AppServiceProvider. Now it seems to work well.– JacopoStanchi
Apr 23 '18 at 14:48
Write the solution as an answer.
– Troyer
Apr 23 '18 at 14:50
@Troyer That's done.
– JacopoStanchi
Apr 23 '18 at 15:04