I have created a migration table 'result' and deleted it but now migration refresh is not working. Showing following error.
[ErrorException] Undefined index:
2017_02_20_090135_create_results_table
I have used composer dump-autoload and it doesn't solve the problem.
Please help me.
You need to go to your migrations table in your database and delete the row where migration = 2017_02_20_090135_create_results_table.
One way to do this would be:
php artisan tinker
then
DB::table('migrations')->where('migration', '2017_02_20_090135_create_results_table')->delete();
It might also be an idea to delete the table as well.
Hope this helps!
Related
So I'm trying to publish a project to a local folder, which normally works. But as soon as I get contents from another site to implement the new update into it, it fails. There are no errors what so ever, and in the suggested tmp-file, it says to check the output window. I am using Umbraco Version 7.15.5.
Thank you for your help in advance!
The error:
The tmp-file:
The output-window:
The Error List:
Publish-Window:
Please make Delete existing file as False. Delete the files manually and check.
I am trying to add and update second migration in asp.net core with a different name from Initial Migration, but during update-database the error says There is already an object named 'Values' in the database. How can I can I update the new Entity and not update the Values object.
it seems there is a problem in migration process,
run add-migration command in "Package Manager Console"
Add-Migration Initial -IgnoreChanges
do some changes, and then update database from "Initial" file:
Update-Database -verbose
For more details refer this link
https://stackoverflow.com/a/43687656/495455
Thanks for help, I finally find a solution. I had to remove all migrations and it worked perfectly with different name for the second migration
I can't find official documentation of this method.
All I found is that it apply migrations that didn't applied yet (and create db if not exists).
but how it work?
is it look at the db Migration History table to see which migration missed?
and what if somehow it see that Migration History table has more migrations than in migrations folder? is it downgrade them?
thanks!
Does it look at the db Migration History table to see which migration are missing?
Yes, and applies any missing migrations in chronological order.
What if somehow it sees that the Migration History table has more migrations than in the migrations folder? Does it revert them?
It does nothing. They might be for a different model/DbContext/application that is using the same database.
In my application I enable Code First Migrations with some migrations, Also I use SQL Server Compact for integration test.
When I run my tests, Entity Framework create an empty database and tries to run migration on that empty database and thrown The specified table does not exist.
Based on this report I think usage of Migration in Entity Framework 6 has changed.
I test all Database Initializer with Context.Database.Create(); but in all case tabale's never created.
I don't know that this is EntityFramework's bug or not, but when I made rename the namespace of Migration Configuration class from default (Projectname/Migrations) to any none default name, migration works well.
Context.Database.Create() will not execute migrations! It only creates empty db. To Update database from code to latest version you need to use DbMigrator.Update method:
var migrator = new DbMigrator(new MyMigrationsConfiguration());
migrator.Update();
Alternatively you might use MigrateDatabaseToLatestVersion
Database.SetInitializer(new MigrateDatabaseToLatestVersion<BlogContext, Configuration>());
It is described in details here: http://msdn.microsoft.com/en-us/data/jj591621.aspx#initializer
In case someone still struggles to fix the issue.
The code that follows works for me: add-migration MyFirstMigration
Meanwhile add-migration "MyFirstMigration" with the migration name ramped in quote doesn't work.
There may be previous migration files which the ide may be referring to mostly likely due to caching.
Drop backup and drop target database if it exists, and drop the migration folder.
Now add the migration and you will be good to go.
It does happens when adding model and running add-migration command.
Here is the simplest cause of this issue:
Add a newly added model property into IdentityDbContex class.
Here are the steps:
create model
add property into IdentityDbContex class
run add-migration
update-database
I am to integrate sfGuard plugin with existing application. What I want to do is to keep as much code as possible untouched. Any guides? It'd be perfect if I can use actual database schema, or bind it somehow to be used by sfGuard. I know about setting userProfile class but I'm not sure how should I get to it, not to destroy my app.
Greetings
Just install plugin. And try make migrations. doctrine::generate-migrations-diff
php symfony doctrine:generate-migrations-diff
And migrate php symfony doctrine:migrate :
php symfony doctrine:migrate
Check out question: Rebuild model without loss data in MySQL for Symfony