Results 1 to 3 of 3

Thread: Database Migration Woes Entity Framework 4.1 Code First

  1. #1
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 00
    Location
    off others' brains
    Posts
    4,329

    Database Migration Woes Entity Framework 4.1 Code First

    We are following the Entity Framework Code First model and developing a couple of applications. Now we have production/staging/development databases, and I need a good way to ensure changes are properly effected in each of the environments.

    The blunt approach is to have the app create an empty database (or deploy an empty database) and then migrate all the necessary data, but this is just a lame way of doing things.

    I checked online and there are suggestions for VSDBCMD (?), but we only have VS 2010 prof, so no database projects to speak of.

    Any other solution?

    If I migrated to EF 4.3 which supposedly has support for migrations, do I need to change anything else in the code?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,782

    Re: Database Migration Woes Entity Framework 4.1 Code First

    We generally use Management Studio to generate scripts for creation of tables and, if required, insertion of data. Such a script can be run by SQLCMD directly, from a batch file or from a Custom Action during installation.

  3. #3
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 00
    Location
    off others' brains
    Posts
    4,329

    Re: Database Migration Woes Entity Framework 4.1 Code First

    This is my scenario: I have development going on on four different machines (which in turn may have their own database versions). At the end of the development cycle, I use a staging machine (usually my laptop) where all the changes are integrated and the final database structure created.

    Now the changes have to be deployed on a staging server, which has an older copy of the database. How do I synchronize the database on the staging server with that on my laptop? I could generate the DDL scripts from Management Studio, but I can't run them as they are on the staging server database.

    Is there a way I can generate the change scripts through Management Studio automatically?
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •