Jump to content
  • 0

Remove Migration???


nvh

Question

Spoiler

System.NotSupportedException
  HResult=0x80131515
  Message=SQLite does not support this migration operation ('AddForeignKeyOperation'). For more information, see http://go.microsoft.com/fwlink/?LinkId=723262.
  Source=Microsoft.EntityFrameworkCore.Sqlite
  StackTrace:
   at Microsoft.EntityFrameworkCore.Migrations.SqliteMigrationsSqlGenerator.Generate(AddForeignKeyOperation operation, IModel model, MigrationCommandListBuilder builder)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Intersect.Server.Database.DbInterface.InitDatabase(IServerContext serverContext) in E:\DuAnGame\Intersect\MMORPG\Intersect-Engine-prerelease\Intersect.Server\Database\DbInterface.cs:line 263
   at Intersect.Server.Core.Bootstrapper.PostContextSetup() in E:\DuAnGame\Intersect\MMORPG\Intersect-Engine-prerelease\Intersect.Server\Core\Bootstrapper.cs:line 282
   at Intersect.Server.Core.Bootstrapper.Start(String[] args) in E:\DuAnGame\Intersect\MMORPG\Intersect-Engine-prerelease\Intersect.Server\Core\Bootstrapper.cs:line 80
 

I want delete (undo) my migration. i forgot backup my project :((

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
1 hour ago, Beefy Kasplant said:

Don't think that's possible. There's a reason it gives you a warning and then makes you confirm manually that you want to start the migration process.

I haven't entered the "READY" command on the server yet. does that help me recover?

Link to comment
Share on other sites

  • 0

I have found personally reverting database migrations can be a bit of a nasty process. Always back up your DB and have something separate to work on in your development environment. If something happens to your db in your dev environment, you can manually delete the migration file (if I remember right its a generated .cs file. The name is auto generated I believe). If you mess up a database during a migration, just delete it and revert back to your backup copy, fix the mistakes you made, and rerun the migrations in your backed up database. The databases are the .db files in your resource directory on your server. Never use your production databases in your dev environment. Deleting or damaging your DB files will delete game and player data. If you need game data that is in your production environment, copy your db files over to dev environment. I think intersect supports mysql too, i dunno if you're using it, but if you are setup a development mysql server to work on. The process for backups and recovery with mysql is a bit more of a hassel, and I don't know all the steps to explain it off the top of my head, but there are guides online for it.

 

On actually fixing your issue, you are going to need to go in with an sql browser and edit your database files manually and undo whatever the transactions did manually, and then manually delete your migration. I don't know what you did in your migration so i can't tell you exactly what you need to do to fix it.

 

DON'T FORGET: Make a backup of the already damaged db files in case you damage them some more trying to manually fix it

 

Link to comment
Share on other sites

  • 0
9 hours ago, Oddly said:

I have found personally reverting database migrations can be a bit of a nasty process. Always back up your DB and have something separate to work on in your development environment. If something happens to your db in your dev environment, you can manually delete the migration file (if I remember right its a generated .cs file. The name is auto generated I believe). If you mess up a database during a migration, just delete it and revert back to your backup copy, fix the mistakes you made, and rerun the migrations in your backed up database. The databases are the .db files in your resource directory on your server. Never use your production databases in your dev environment. Deleting or damaging your DB files will delete game and player data. If you need game data that is in your production environment, copy your db files over to dev environment. I think intersect supports mysql too, i dunno if you're using it, but if you are setup a development mysql server to work on. The process for backups and recovery with mysql is a bit more of a hassel, and I don't know all the steps to explain it off the top of my head, but there are guides online for it.

 

On actually fixing your issue, you are going to need to go in with an sql browser and edit your database files manually and undo whatever the transactions did manually, and then manually delete your migration. I don't know what you did in your migration so i can't tell you exactly what you need to do to fix it.

 

DON'T FORGET: Make a backup of the already damaged db files in case you damage them some more trying to manually fix it

 

I hope in the future this will be easier. Luckily I fixed it and my game is back up :)

Link to comment
Share on other sites

  • 0
14 hours ago, nvh said:

I hope in the future this will be easier. Luckily I fixed it and my game is back up :)


To be fair, database migrations are always difficult. I work similar database implementations at work in C# as they use in intersect, we tried migrations out for a while, I guess the developers before me decided to stop keeping up with it in our api, because we dropped support for automatic migrations. And as far as making copies and backups of databases, Its pretty standard in the industry to have a seperate development database that is a clone of your original. I've worked on projects with 3 different environments, dev, staging, and production. Production is of course the client use, staging is when we need to show of code to the client that is ready to be deployed to production, you can imagine it like a beta, and then dev is to development on.... Oh and I guess we had a QA too which was for our QA department to test our code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...