Changes between Version 5 and Version 6 of DeveloperGuidelines/DatabaseSynchronization


Ignore:
Timestamp:
09/12/10 10:01:33 (11 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/DatabaseSynchronization

    v5 v6  
    1 DeveloperGuidelines
     1[[TOC]]
     2= Database Synchronization =
    23
    3 == Database Synchronization ==
    4 All tables which should be replicated need 2 fields:
     4== Requirements ==
     5All tables which should be replicated need to include the 2 reusable fields, {{{timestamp}}} & {{{uuidstamp}}}:
    56{{{
    6 SQLField('modified_on','datetime',default=now), # Also needed for T2's conflict detection anyway
    7 SQLField('uuid',length=64,default=uuid.uuid4()),
     7table = db.define_table(tablename, timestamp, uuidstamp, ... )
    88}}}
    99
    10 If using T2 CRUD, then this is all that is required.
     10If using the S3 REST Controller, then this is all that is required.
    1111
    12 If needing to support multiple tables & hence doing manual form processing, then you just need to add support within the add_record controller function:
     12== Manual Form processing ==
     13If doing manual form processing, then you need to add support within the add_record controller function:
    1314{{{
    14 if form.accepts(request.vars,session,keepvalues=True):
     15if form.accepts(request.vars, session, keepvalues=True):
    1516    # Update Database
    16     id=db.table.insert(
    17         uuid=uuid.uuid4(),
     17    id = db.table.insert(uuid=uuid.uuid4())
    1818}}}
    1919
     20== Master Copy Index ==
     21The {{{mci}}} field is included as part of the {{{uuidstamp}}} reusable field.
     22* mci=0 => Original source of Data
     23* mci=1 => We received this from the original source
     24* mci=2 => We received this from someone who got it from the original source
     25* etc
     26* mci=-1 => Data which shouldn't be synced (typically Reference Data)
    2027
     28== Sync Resolvers ==
     29Special rules can be developed which extend the default S3Vector class to deal with resource-specific issues.
     30
     31== Future ==
    2132This functionality needs to be developed further to provide a custom UI to do the Import/Export (currently can just use appadmin's default one):
    2233 * BluePrintSynchronisation