Uploaded image for project: 'Document Management System'
  1. Document Management System
  2. DMS-1663

DMS transaction history : Dynamic trigger generation for history table

    Details

    • Company:
      All Clients/Multiple Clients

      Description

      DMS transaction history : Dynamic trigger generation for history table

      CC : Samir Rohan J Khandave

        Attachments

          Issue Links

            Activity

            sonali.farakate Sonali Farakate (Inactive) created issue -
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Field Original Value New Value
            Link This issue relates to DMS-343 [ DMS-343 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Description DMS transaction history : Dynamic trigger generation for history table DMS transaction history : Dynamic trigger generation for history table

            CC : [~samir] [~rohan.khandave]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) logged work - 19/Jul/19 02:44 AM
            • Time Spent:
              4h
               

              Analysis for achieving the outcome

            samir Samir made changes -
            Fix Version/s CBAT Offer Letter - Fall [ 10607 ]
            samir Samir made changes -
            Labels Integration-CBAT
            samir Samir made changes -
            Sprint DMS - Fall Sprint 8 [ 167 ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) logged work - 23/Jul/19 02:45 AM
            • Time Spent:
              8h
               

              Analysis and script creation
              Issues resolving - secure-file-priv

            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Status To Do [ 10000 ] In Progress [ 3 ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Hide
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) added a comment -

            Hi Sonali Farakate,

             

            The script for creating the History table along with triggers is completed.

            I have attached the script in this Jira. Also, there are inline comments for using that query.

            Create_Trigger_and_HistoryTable_MYSQL.sql

             

            -------------------------------------------------------------------------------------------------

            Naming Conventions  : 

            For eg : 
            Main Table - Communication
            For this below will be the outcome from the script :

            History table -  Communication_History
            Triggers Name - trg_Communication_insert, trg_Communication_update, trg_Communication_delete

            -------------------------------------------------------------------------------------------------

             

            Below are some changes that I have done and impediments that I'm facing  : 

            Changes Server Level :

            Disable - secure-file-priv option - As we are writing out queries into a file and not creating directly, this feature needs to be disabled. I have disabled it for local server and will disable for rest of environments as required.

             

            Impediments :

            Queries are written into a file: As of now, we cannot have the drop and exists statements in a dynamic query as it is not a feature in MYSQL.
            We have to change the path for writing out the queries in the file which will give us all the statements. If we want to pass the path as variable and parameter to SP, the query needs to be a prepared statement which will take time with analysis. 

             

            We can have this in the further scope of development. Please review the script and let me know if any queries.

             

            Regards,

            Rushikesh

            CC - Rohan J Khandave Samir Satya

             

             

            Show
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) added a comment - Hi Sonali Farakate ,   The script for creating the History table along with triggers is completed. I have attached the script in this Jira. Also, there are inline comments for using that query. Create_Trigger_and_HistoryTable_MYSQL.sql   ------------------------------------------------------------------------------------------------- Naming Conventions   :  For eg :   Main Table - Communication For this below will be the outcome from the script : History table -  Communication_History Triggers Name - trg_Communication_insert, trg_Communication_update, trg_Communication_delete -------------------------------------------------------------------------------------------------   Below are some changes that I have done and impediments that I'm facing  :  Changes Server Level : Disable - secure-file-priv option - As we are writing out queries into a file and not creating directly, this feature needs to be disabled. I have disabled it for local server and will disable for rest of environments as required.   Impediments : Queries are written into a file: As of now, we cannot have the drop and exists statements in a dynamic query as it is not a feature in MYSQL. We have to change the path for writing out the queries in the file which will give us all the statements. If we want to pass the path as variable and parameter to SP, the query needs to be a prepared statement which will take time with analysis.    We can have this in the further scope of development. Please review the script and let me know if any queries.   Regards, Rushikesh CC - Rohan J Khandave Samir Satya    
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Assignee Rushikesh Dattatray Bane [ rushikesh.bane ] Sonali Farakate [ sonali.farakate ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Resolution Done [ 10000 ]
            Status In Progress [ 3 ] Done [ 10001 ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Remaining Estimate 0h [ 0 ]
            Time Spent 4h [ 14400 ]
            Worklog Id 190972 [ 190972 ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Time Spent 4h [ 14400 ] 12h [ 43200 ]
            Worklog Id 190974 [ 190974 ]
            rushikesh.bane Rushikesh Dattatray Bane (Inactive) logged work - 24/Jul/19 02:46 AM
            • Time Spent:
              4h
               

              Customization and changes - Script refining

            rushikesh.bane Rushikesh Dattatray Bane (Inactive) made changes -
            Time Spent 12h [ 43200 ] 16h [ 57600 ]
            Worklog Id 190975 [ 190975 ]
            sonali.farakate Sonali Farakate (Inactive) logged work - 24/Jul/19 09:34 PM
            • Time Spent:
              6h
               

              Trigger generation script modifications

            sonali.farakate Sonali Farakate (Inactive) made changes -
            Resolution Done [ 10000 ]
            Status Done [ 10001 ] In Progress [ 3 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Attachment HistoryTableConsiderations.xls [ 114529 ]
            Hide
            sonali.farakate Sonali Farakate (Inactive) added a comment - - edited

            Hi Rohan J Khandave,

            I have updated the trigger creation script shared by Rushikesh Dattatray Bane.
            Changes Done:

            1. Added column ModifiedUserID
            2. Added SystemTime as per UTC
            3. Separated History table creation part.

            As per the new script I have created the triggers for following tables,

            1. address
            2. assignment
            3. company
            4. codelist
            5. companysourceproductmapping
            6. dmscustomfieldmapping
            7. dmsfields
            8. document
            9. email
            10. emailaction
            11. emailplaceholder
            12. phone
            13. sourceproductuser
            14. sourcesystemfieldlabel
            15. sourcesystemfields
            16. users
            17. person
            18. assignmentcustomattributedata
            19. personcustomattributedata
            • For each table 3 triggers are created with name like
            1. Trigger_tablename_Insert
            2. Trigger_tablename_Update
            3. Trigger_tablename_Delete
            • Stored procedure 'CreateTriggersForTable' will generate the triggers to insert data in history table.

            How to use SP CreateTriggersForTable?
            1. Inputs : dbName,tableName
            2. Change : Need to update the value of OUTFILE in SP as per the requirement(i.e. need to provide the folder path with filename.sql) 
            3. Output : This SP will create a file(with provided name in OUTFILE) in which we get the 3 triggers generated for history table.

            NOTE :
            Need to create 3 different files of these with above mentioned naming convention and check-in into '\DMS\Databases Objects\05_Triggers' folder.
            Need to generate these triggers each time on ALTER table and update the existing triggers with new.

            Thanks,
            Sonali Farakate

             CC : Samir 

            Show
            sonali.farakate Sonali Farakate (Inactive) added a comment - - edited Hi Rohan J Khandave , I have updated the trigger creation script shared by Rushikesh Dattatray Bane . Changes Done: Added column ModifiedUserID Added SystemTime as per UTC Separated History table creation part. As per the new script I have created the triggers for following tables, address assignment company codelist companysourceproductmapping dmscustomfieldmapping dmsfields document email emailaction emailplaceholder phone sourceproductuser sourcesystemfieldlabel sourcesystemfields users person assignmentcustomattributedata personcustomattributedata For each table 3 triggers are created with name like Trigger_tablename_Insert Trigger_tablename_Update Trigger_tablename_Delete Stored procedure 'CreateTriggersForTable' will generate the triggers to insert data in history table. How to use SP CreateTriggersForTable? 1. Inputs : dbName,tableName 2. Change : Need to update the value of OUTFILE in SP as per the requirement(i.e. need to provide the folder path with filename.sql)  3. Output : This SP will create a file(with provided name in OUTFILE) in which we get the 3 triggers generated for history table. NOTE : Need to create 3 different files of these with above mentioned naming convention and check-in into '\DMS\Databases Objects\05_Triggers' folder. Need to generate these triggers each time on ALTER table and update the existing triggers with new. Thanks, Sonali Farakate  CC : Samir  
            sonali.farakate Sonali Farakate (Inactive) logged work - 26/Jul/19 05:35 AM
            • Time Spent:
              6h
               

              Trigger generation

              Check-ins

              Discussion with Rohan and Ramya regarding tables

            sonali.farakate Sonali Farakate (Inactive) made changes -
            Time Spent 16h [ 57600 ] 22h [ 79200 ]
            Worklog Id 191572 [ 191572 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Time Spent 22h [ 79200 ] 28h [ 100800 ]
            Worklog Id 191573 [ 191573 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Resolution Done [ 10000 ]
            Status In Progress [ 3 ] Done [ 10001 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Status Done [ 10001 ] Code Review [ 11801 ]
            sonali.farakate Sonali Farakate (Inactive) made changes -
            Assignee Sonali Farakate [ sonali.farakate ] Samir [ samir ]
            ashwin.wankhede Ashwin Wankhede (Inactive) made changes -
            Status Code Review [ 11801 ] In QA Testing [ 11901 ]
            ashwin.wankhede Ashwin Wankhede (Inactive) made changes -
            Assignee Samir [ samir ] Priya Dhamande [ priya.dhamande ]
            shashikant.mishra ShashiKant Mishra (Inactive) made changes -
            Sprint DMS - Fall Sprint 8 [ 167 ] DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1 [ 167, 173 ]
            shashikant.mishra ShashiKant Mishra (Inactive) made changes -
            Sprint DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1 [ 167, 173 ] DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1, DMS - Gap Fall & Win Sprint 2 [ 167, 173, 174 ]
            Raj.Hawaldar Raj Hawaldar (Inactive) made changes -
            Status In QA Testing [ 11901 ] In QA Testing [ 11901 ]
            shashikant.mishra ShashiKant Mishra (Inactive) made changes -
            Sprint DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1, DMS - Gap Fall & Win Sprint 2 [ 167, 173, 174 ] DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1, DMS - Gap Fall & Win Sprint 2, DMS - Gap Fall & Win Sprint 3 [ 167, 173, 174, 177 ]
            shashikant.mishra ShashiKant Mishra (Inactive) made changes -
            Sprint DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1, DMS - Gap Fall & Win Sprint 2, DMS - Gap Fall & Win Sprint 3 [ 167, 173, 174, 177 ] DMS - Fall Sprint 8, DMS - Gap Fall & Win Sprint 1, DMS - Gap Fall & Win Sprint 2, DMS - Gap Fall & Win Sprint 3, DMS - Gap Fall & Win Sprint 4 [ 167, 173, 174, 177, 179 ]
            Hide
            priya.dhamande Priya Dhamande (Inactive) added a comment -

            No QA inputs required. So, marking jira done.

            Show
            priya.dhamande Priya Dhamande (Inactive) added a comment - No QA inputs required. So, marking jira done.
            priya.dhamande Priya Dhamande (Inactive) made changes -
            Status In QA Testing [ 11901 ] Done [ 10001 ]
            Transition Time In Source Status Execution Times
            Rushikesh Dattatray Bane (Inactive) made transition -
            To Do In Progress
            6d 20h 13m 1
            Sonali Farakate (Inactive) made transition -
            Done In Progress
            1d 18h 42m 1
            Sonali Farakate (Inactive) made transition -
            In Progress Done
            8h 37m 2
            Sonali Farakate (Inactive) made transition -
            Done Code Review
            2s 1
            Ashwin Wankhede (Inactive) made transition -
            Code Review In QA Testing
            3d 19h 25m 1
            Raj Hawaldar (Inactive) made transition -
            In QA Testing In QA Testing
            28d 22h 4m 1
            Priya Dhamande (Inactive) made transition -
            In QA Testing Done
            19d 3h 11m 1

              People

              Assignee:
              priya.dhamande Priya Dhamande (Inactive)
              Reporter:
              sonali.farakate Sonali Farakate (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 28h
                  28h