Merging 2 SQL Server Databases Structures -


my system started life single winforms application single database using entity framework. down line, database branched off encompass new system extended new tables. main employee table renamed person, , associated fk references renamed term person in columns.

the existing system has since changed in terms of database structure new tables added.

something like:

system history

now want bring 2 databases in line, keeping person table on employee. need bring 2 entity frameworks together. need tips , pointers on how this.

luckily new system still in uat not live. have base population scripts this.

i use nhydrate maintain both entity frameworks - db first. database side of things can cope with. however, unsure of best way bring entity frameworks in line.

there tools have used sync databases such red gate's sql compare. vs2013 has nice sql schema compare.

i have couple thoughts on different ways this:

thought 1

  1. manually add changes through ef database designer
  2. generate new database
  3. script data copy initial system new database
  4. run population scripts new system.

thought 2

  1. manually add changes through ef database designer
  2. upgrade existing system
  3. run population scripts new system

thought 3

  1. somehow merge csdl, msl, ssdl files entity framework winmerge example
  2. upgrade existing system
  3. run population scripts new system

i endeavour on quest, possibly thought #3 unless posts responses on here. want know how community go one.

i thought copy , paste 1 model other fail, tried first , did. also, suggestion of merging csdl, msl, ssdl files no-go generated in line database.

what tried , worked use redgates sql compare:

  1. run sql compare on new system changes , existing system changes.

    this generates upgrade script run against existing system changes.

  2. import database model

    refresh ef model existing system changes upgrade.

  3. generate new database current ef model - merged changes

  4. run sql compare on initial db , merged changes.

    now have complete script go initial db merged changes.

for table renamed in existing changes, had tweak script copy data before dropping old table. took little doing , trail , error works me.

hope might in position.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -