Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to solve Update-Database issue when switching branch? #4804


User avatar
0
manojreddy created

I have one entity which has a column as int in Branch A. Now I switch to a different BranchB. There I create a migration and change column to varchar and runUpdate-Database. Now If I switch to Branch A again. If I see in the code the column datatype isint, but in the database, its datatype is varchar. But I want its datatype to be int. I can not even remove this migration from BranchA because it was created in Branch B.I can see only one way to solve this issue is to delete the database and run Update-Database, But I will lose all data by doing this. Is there any better way to solve this issue.


5 Answer(s)
  • User Avatar
    0
    hitaspdotnet created

    Hi I think you can create a Db backup and edit your query file then attach that again. Or use VS SQL Object Explorer right click on target table then click "View Code". Then change that column type. If your data is +1000 rows I'm not sure for this solution.

  • User Avatar
    0
    hitaspdotnet created

    If your rows is +1000 and you still want keep that, the best way for keeping that columns is changing "int" to "varchar" and use TypeConverter for new entries . You can create a excitation for that.

  • User Avatar
    0
    alper created
    Support Team

    This has nothing to do with AspNet Zero.

  • User Avatar
    0
    manojreddy created

    Yes, its not at all related to AspNet Zero. But this is very common problem for a developer who is using AspNet Zero and working on multiple branches concurrently.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @ManojReddy use different databases for each branch.