Changes between Version 5 and Version 6 of DeveloperGuidelines/DatabaseSynchronization
- Timestamp:
- 09/12/10 10:01:33 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/DatabaseSynchronization
v5 v6 1 DeveloperGuidelines 1 [[TOC]] 2 = Database Synchronization = 2 3 3 == Database Synchronization==4 All tables which should be replicated need 2 fields:4 == Requirements == 5 All tables which should be replicated need to include the 2 reusable fields, {{{timestamp}}} & {{{uuidstamp}}}: 5 6 {{{ 6 SQLField('modified_on','datetime',default=now), # Also needed for T2's conflict detection anyway 7 SQLField('uuid',length=64,default=uuid.uuid4()), 7 table = db.define_table(tablename, timestamp, uuidstamp, ... ) 8 8 }}} 9 9 10 If using T2 CRUD, then this is all that is required.10 If using the S3 REST Controller, then this is all that is required. 11 11 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 == 13 If doing manual form processing, then you need to add support within the add_record controller function: 13 14 {{{ 14 if form.accepts(request.vars, session,keepvalues=True):15 if form.accepts(request.vars, session, keepvalues=True): 15 16 # Update Database 16 id=db.table.insert( 17 uuid=uuid.uuid4(), 17 id = db.table.insert(uuid=uuid.uuid4()) 18 18 }}} 19 19 20 == Master Copy Index == 21 The {{{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) 20 27 28 == Sync Resolvers == 29 Special rules can be developed which extend the default S3Vector class to deal with resource-specific issues. 30 31 == Future == 21 32 This functionality needs to be developed further to provide a custom UI to do the Import/Export (currently can just use appadmin's default one): 22 33 * BluePrintSynchronisation