Room auto migration: Migration didn't properly handle: - android-room

I am using room library in my app. I added new column in my entity witch holds list of object. Room can't after migrate this entity. In android studio I got error message Migration didn't properly handle: EntityName. Android studio returns two type of table expected and found.
In found table I did't find my new column.
I am using room 2.4.3 this version is supporting auto migrate but doesn't work

Related

Coredata lightweight migration "Can't find mapping model for migration"

I am doing a coredata database migration using lightweight migration in xcode4.5, I kept on getting "Can't find mapping model for migration" when I set "NSInferMappingModelAutomaticallyOption" to "NO". If I set "NSInferMappingModelAutomaticallyOption" to "YES", lightweight migration passes without problem.
Here is the steps I followed:
add a new model version .xcdatamodelId
make changes on the entities (including adding a new entity)
select the newer versioned datamodel as the current version, generate the new NSManagedObject subclasses, and make correspondant changes to the code.
create a mapping model and make the source points to the old datamodel version and the destination points to the new datamodel version
create custom migration policy and hook it up with one of the mappings inside the
mapping model
set up lightweight migration with "NSInferMappingModelAutomaticallyOption" equals to "NO".
test migration on simulator with the database coming from an older build.
I followed all and steps talked on apple documents and didn't make any changes on the entity schema after creating the mapping.. I tried to clean the DerivedData folder in xcode, and also I check the "VersionInfo.plist" which contains the correct versions of my datamodel. For the unchanged entities their hashkey are matching.
However I still get this error when I tried to do an migration.... Quite frustrated now.. Anyone can help to give me some guid on this problem?

EntityKey properties of type “Geography” not supported. Entity Framework 5, VS 2012 – Database First

Created a SQL Server 2008 database and table with a property called “Coordinates” of type “geography”. In VS 2012 created a project, added references to Microsoft.SqlServer.Types and EF V5. Then, using the ADO.NET Entity Data Model wizard generated the edmx. When I compile in VS 2012 I get the following error:
Error 4 Error 129: The property 'Coordinates' in EntityType 'DBModel.GeoDestination' is not valid. EntityKey properties that are of type 'Geography' are currently not supported.
Many of the samples on the web are “code first” examples that use the type “DbGeography” as a type in their c# code and generate the database from the code resulting in a table with a property of type “geography”.
How do I do this database first and fix up the type? It does not appear that “DBGeography” is in the drop down list of types when using the “Table Mapping” view.
Using EF 5, NET 4.5, VS 2012 SP 1, SQL Server Types
I figured this out. Looks like a bug in the wizard. If the table in SQL does not have a primary key, the wizard automatically generates a key(s) in the resulting EF model. It appears random, sometimes one key is generated and sometimes it makes several properties keys. A Geography data type cannot be a key. It was not a key in the table, but the wizard made it a key.
Hope this response helps others.

MVC3 EDMmetadata table not found

I am new in MVC3 i am going to create a MVC3 test project where i am create model class name WhiteAccount with ID,Name,Email,Password property. and successfully create a DB but when i add another new property in that WhiteAccount model class and in my DB table too but it give me some error. Some people say just delete the EDMmetadata table from your DB, But Here is the problem i have no EDMmetadata table in my DB ! I create my DB by EntityFramework v4.3.1 system automatically (CodeFirst). What should i do now ?
Check for the __MigrationHistory table.
Open the nuget package manager console and run
update-database -script
It will likely give you a message about having to enable it first, follow those directions
Run: Enable-Migrations
some more info on migrations
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx
Im gathering this table is there in your db (under system tables) and it contains your model information. Since your project changed you need to tell the migrations about the new field or delete the table (__MigrationsHistory)

modyfing a sqlite db mapped via core data throws errors: uncaught exception of class 'NSCFString'

I have an iphone app that has a sqlite db, mapped to core data. All the data manipulation in the app is via Coredata.
On one table I wanted to add a string attribute. And I did two things both with similar crashes:
I tried to use Mesasql to alter the structure. I easily added a Varchar column. But it crashes.
On a separate attempt, with the mapped SQLlite db, restored, I tried adding a attribute to the entity in core data and it crashed.
This is the error I got:
* Terminating app due to uncaught exception of class 'NSCFString'
terminate called after throwing an instance of 'NSCFString'
So, how can I alter the structure of the sqlite table mapped to core data without breaking the app? Am I fogetting to do a commit or something like that?
Please help
Every time you modify an entity you have to delete the sqlite store. If your application has already shipped, the alternative is to migrate your data. This SO answer offers a simple explanation of how to do that.

Database migrations in Grails

Suppose I have a database containing 3 tables in a grails application:
User
Activity
Friend
User table table has one to many relation to Activity and Friend tables so in User table I have:
static hasMany = [activies: Activity, friends: Friend]
and in Friend and Activity I have:
static belongsTo User.
Application is deployed and lets says thousands of customers have registered. Now changes are made in the database: Table Activity is dropped. A table Journal is created which is on the many sides of the User table. The User table has a new column added and this column cannot be null. An old column in Friend table is deleted that was also defined as not null.
So given above scenario and assume using MySQL what needs to be done to make above changes without deleting existing customers data and safely add the new table to existing customers?
Ruby on Rails comes with ActiveRecord for database migrations. Does Grails comes with something like this out of the box?
Currently in development when I run my grails application after adding a new not null column to a table, I get column cannot be null exception thrown unless I delete that table in the database before running grails application which would recreate the table if not exists. Obviously once the application is deployed I will not have the luxury to delete the table.
Unfortunately, the current version of Grails doesn't come with database migration. However, there is a plugin for Liquibase which makes migrations possible.
The next version of Grails (1.4, planned for Q1 2011) will supposedly contain a built-in migration tool, which I am very much looking forward to.
Note: I haven't used the Liquibase plugin, so I don't have any firsthand experience with it. I have seen numerous blog posts describing its use, however, and I'm probably going to use it in my next Grails project if 1.4 isn't out by then.

Resources