Dropping Columns referenced by other Tables
-
Hi I have 3 Tables Cases, Programs, Violations, now all these Tables are related as ManyToMany with Notice Table, but earlier they were having OneToMany, but now they are related ManyToMany, hence I moved them all to the Associated Table to handle it, which is called as ManyToMany table which has PK, ParentyEntity, ParentEntityId (which is PK of Notices table), ChildEntity, ChildEntityId - I have to do it with Entity Framework Code First Migrations - hence I am trying to be very cautious here. What am I planning are 1.Take backup of the Database 2. Migrate Data from tables to ManyToMany table 3. Record all the Foreign Key Constraints first (like generate scripts for those FKs references) then drop all those Foreign Keys 4. Then Drop tables using Entity Framework Code First Migrations. Can somebody please help me if I am missing anything and are there any easy fool proof ways to do the same and how to drop columns using Entity Framework Migrations - I have lost touch with Code First approach, I understand its tough and needed very careful implementation - any suggestion any help would be very very helpful. Actually the Database has already have been implementing this - but they didn't drop the old columns and didn't delete the data from old columns - hence its creating or showing inconsistent Data, the old programmer has left it in between - need a lot of suggestions and support - thanks a lot.
-
Hi I have 3 Tables Cases, Programs, Violations, now all these Tables are related as ManyToMany with Notice Table, but earlier they were having OneToMany, but now they are related ManyToMany, hence I moved them all to the Associated Table to handle it, which is called as ManyToMany table which has PK, ParentyEntity, ParentEntityId (which is PK of Notices table), ChildEntity, ChildEntityId - I have to do it with Entity Framework Code First Migrations - hence I am trying to be very cautious here. What am I planning are 1.Take backup of the Database 2. Migrate Data from tables to ManyToMany table 3. Record all the Foreign Key Constraints first (like generate scripts for those FKs references) then drop all those Foreign Keys 4. Then Drop tables using Entity Framework Code First Migrations. Can somebody please help me if I am missing anything and are there any easy fool proof ways to do the same and how to drop columns using Entity Framework Migrations - I have lost touch with Code First approach, I understand its tough and needed very careful implementation - any suggestion any help would be very very helpful. Actually the Database has already have been implementing this - but they didn't drop the old columns and didn't delete the data from old columns - hence its creating or showing inconsistent Data, the old programmer has left it in between - need a lot of suggestions and support - thanks a lot.
"Code First" is "easy"; it's hard when you're thinking about "conversion" when still developing a data model. The final model drives the conversion process ("ETL"); not the other way around.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
"Code First" is "easy"; it's hard when you're thinking about "conversion" when still developing a data model. The final model drives the conversion process ("ETL"); not the other way around.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
Can you please elaborate a little bit buddy?
Gerry Schmitz wrote:
"Code First" is "easy";
I understood that
Gerry Schmitz wrote:
it's hard when you're thinking about "conversion"
Which conversion?
Gerry Schmitz wrote:
when still developing a data model
The Data model is already developed, I am maintaining the application, I am scared if I drop the column from Code, it will drop that column permanently from Database and how am I going to migrate the data? I think I will have to write my own scripts for it, am I correct my friend? Any detailed suggestions or links anything helps my friend - but even for this I thank you for taking your time to answer my queries - its a great help.
Gerry Schmitz wrote:
The final model drives the conversion process ("ETL"); not the other way around
I didn't really get this, means ETL should migrate the Data how? - thank you my friend.
-
"Code First" is "easy"; it's hard when you're thinking about "conversion" when still developing a data model. The final model drives the conversion process ("ETL"); not the other way around.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
Hi, unfortunately I have deleted the tables that are created by entity framework Code first migration file manually, now when i am running the migrations or add migration file, its throwing error when running the Update-Database command. What can I do for it now? Can you please help me in this regards buddy? I have the copy of the Deleted migration file, but its not running its giving compile error if I try to run. Can I delete all those tables that are created by running the previous migration file, clean it up and create new fresh migration file and run update database - any-help would be very very helpful. Another problem I tried to run the migration file previous to that of deleted migration file to restore to previous stage - since it could delete the records - that's also not running - any help please to make again fresh start by deleting the newly created tables and create new migration file and run update database.