SHARE
TWEET

explanation

altair0010 Feb 4th, 2016 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Merging Rule
  2. Tables
  3.  
  4. rated table
  5. columns: [ratedId,fName,mName,lName,gender,ratedMergeId]
  6.  
  7. rated_contact table
  8. columns: [ratedContactId,ratedId,contactTypeId,value]
  9.  
  10. contact_type table
  11. columns: [contactTypeId,name,urlTEmplate]
  12.  
  13. rated_merge table
  14. columns: [ratedMergeId,timestamp,ratedId]
  15.  
  16.  
  17. 1. Check form kung meron matching entry sa database if walang matching entries walang merging na magaganap
  18. 2. Kung may match na entry sa form at entry sa database dun papasok yung merging.
  19. 3. So pano yung merging?
  20.     3.1 lahat ng previous records na matching gagawan ng bagong record at imemerge lahat ng data nun.
  21.  
  22. Flow:
  23.  
  24. Upon submission ng form lahat ng form entries papasok sa rated and rated_contact table
  25. ano ano yung mga entries na yun?
  26. {firstName
  27. middleName
  28. lastName,
  29. gender,
  30. city
  31. dateOfBirth,
  32. social network usernames (twitter,facebook,instagram, etc, meron po silang dedicated input boxes sa form);
  33. }
  34.  
  35. ganito po ang gusto kong gawin.
  36. kapag may nag-match, gagawa po ng new entry, ang laman po nitong new entry ay yung mga previous record na meron na at yung bagong record na wala pa.
  37. paano malalaman kung may match?
  38. for example po: nag input ang user ng facebook and twitter username.
  39. ichecheck po kung may matching sa rated_contact table na username.
  40.  
  41. for example merong pong exisiting na entry sa rated at rated_contact table
  42. _____________________________________________________________________________
  43. | ratedId | fName    |   mName   |    lName    | gender |ratedMergeId|active|
  44. -----------------------------------------------------------------------------
  45. |1048     |  Altair  |   Ibn     |   La Ahad   |   male |            |   1  |
  46. -----------------------------------------------------------------------------
  47. ___________________________________________________
  48. |ratedContactId | ratedId | contactTypeId | value |
  49. ---------------------------------------------------
  50. |1              |  1048   |  facebook     |altair |
  51. ---------------------------------------------------
  52.  
  53. then yung user nag input sya sa form ng facebook at twitter username
  54. then upon submission ng form nakita ng system na nagmatch yung facebook username na ininput ni user at yung existing sa database
  55. ang mangyayari ngayon, kukuhanin yung facebook username at twitter username, pati yung personal information na galing sa form
  56. yung previous record galing database will be marked sa deleted (not totally deleted meron isang column sa db for marking as deleted)
  57. then yung latest entry na galing kay user yun ang magiging active entry containing both twitter and facebook usernames.
  58.  
  59. rated table
  60. _____________________________________________________________________________
  61. | ratedId | fName    |   mName   |    lName    | gender |ratedMergeId|active|
  62. -----------------------------------------------------------------------------
  63. |1048     |  Altair  |   Ibn     |   La Ahad   |   male |            |   0  |
  64. -----------------------------------------------------------------------------
  65. |1049     |  Altair  |   Ibn     |   La Ahad   |   male |            |   1  |
  66. -----------------------------------------------------------------------------
  67.  
  68.  
  69. |ratedContactId | ratedId | contactTypeId | value |
  70. ---------------------------------------------------
  71. |1              |  1049   |  facebook     |altair |
  72. ---------------------------------------------------
  73. |2              |  1049   |  twitter      |altair |
  74. ---------------------------------------------------
  75.  
  76. kung mapapapansin po ninyo sa table sa taas nagbago yung ratedId dahil po yung latest record sa rated table is yung 1049 na id at marked as active sya then yung previous marked a inactive (0).
  77.  
  78. paano naman yung ratedMergeId?
  79. sa bawat merging po na magaganap dito po malalagyan ng record yung rated_merge na table
  80. ___________________________________________________
  81. |ratedMergeId |       timestamp         | ratedId |
  82. ---------------------------------------------------
  83. |1            |  02/04/2016 14:04:55    |   1049  |
  84. ---------------------------------------------------
  85.  
  86. then yung bagong insert na ratedMergeId iuupdate iya yung previous at active record
  87. _____________________________________________________________________________
  88. | ratedId | fName    |   mName   |    lName    | gender |ratedMergeId|active|
  89. -----------------------------------------------------------------------------
  90. |1048     |  Altair  |   Ibn     |   La Ahad   |   male |      1     |   0  |
  91. -----------------------------------------------------------------------------
  92. |1049     |  Altair  |   Ibn     |   La Ahad   |   male |      1     |   1  |
  93. -----------------------------------------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top