locked
How to change schema and add a column (Sync Framework 2.0) RRS feed

  • Question

  • I am using the new sync framework 2. I want to setup hub and spoke sync between SQL 2005 and SQL Compact 3.5

    What is the best way to deal with schema changes? I will be mostly adding new columns and sometimes new tables.
    The docs say to update the client database manually by adding the column (see here )

    In my example code I am
    1. Creating a scope (all_tables)
    2. Adding all tables from the Server DB
    3. Applying it to the server
    4. Create the client db
    5. Apply the scope to the client
    6. Synchronising using SqlCeSyncProvider and SqlSyncProvider

    If I add a new column then it is not included in the existing scope. I can't find any way to delete the scope and if I try to create a new one (all_tables2) then I get SQL errors saying that the _tracking table (e.g. Customer_tracking) exists already.
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:58 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, October 21, 2009 11:37 PM

Answers

  • I think I was treating the server as a peer (by using the SqlSyncProvider)

    I am now using SQL 2008 change tracking and using the SqlSyncAdapterBuilder to automatically generate the required adapters. A scope is not needed for the server, only a client.

    Dim currentBuilder As New SqlSyncAdapterBuilder(serverConn)
    currentBuilder.TableName = "Customer"
    currentBuilder.ChangeTrackingType = ChangeTrackingType.SqlServerChangeTracking

    For SQL 2005 I would have to create my own change tracking solution (based on the samples given)
    Thursday, October 22, 2009 10:49 PM