We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27449
    • 211 Posts
    Hello,
    I create three modules in modx for insert information on database, but I want create the backup for the information for when the information it is incorrect update I can go the last information

    how do I do?
      • 26903
      • 1,336 Posts
      If your talking about the standard MODx tables you could look at the Auditor module. It will history changes made to these tables.

      If your talking about user defined tables, i.e. ones you have created you could still adopt the triggering mechanism from your tables to the history database, you’d just have to create the triggers and the tables manually at the mo.
        Use MODx, or the cat gets it!
        • 27449
        • 211 Posts
        I already install de Audit module, but when I select the History Database Name I have an error:
        Warning: mysqli::mysqli() [mysqli.mysqli]: (42000/1049): Unknown database ’database_history’ in C:\wamp\www\modx\assets\modules\auditor\php\main_body.php on line 590
        :S
        I think that I need install the triggers. How I install the triggers on the phpmyadmin?
          • 26903
          • 1,336 Posts
          Ok, it looks as though the database ’database_history’ doesn’t exist, remember you have to create this external to the Auditor module, it wont create it for you. Also this seems a strange name, when you install Auditor it will look for a database named after your MODx database with ’_history’ appended, so if your main MODx database is called ’modx’ it will look for a database called ’modx_history’.

          You can change this to anything you like, but it must still exist.

          Your error would seem to imply that the name of your main MODx database is in fact ’database’ if you didn’t edit the database name.

            Use MODx, or the cat gets it!
            • 27449
            • 211 Posts
            I have the database create but the history database doesn’t have all the tables of the original database

              • 26903
              • 1,336 Posts
              It shouldn’t matter, Auditor will create/recreate the tables it needs and ignore any others.

              Ok, what is the name of your main MODx database?
              What’s the name of your history database?
              What, if anything do you type into the ’history database’ box in the Auditor module when you install it?

                Use MODx, or the cat gets it!
                • 27449
                • 211 Posts
                But I create some table in modx database that I need to have history and this tables don’t appear on the history database.
                I tried copy the tables that I nedd but when I add new information this information don’t appear on the history database...
                My database name is oprc and the name of my history database is oprc_history
                  • 26903
                  • 1,336 Posts
                  OK I think I see what you are doing now, it looks as though your main MODx database oprc and its history database oprc_history are OK as far as the MODx tables go. If you wish to use your own tables do this :-

                  1. Create your tables in your main MODx database, oprc,
                  2. Create the same tables in your history database, orpc_history
                  3. Create the insert/update triggers on the new tables in orpc to copy data to the tables in orpc_history.

                  For an example of trigger syntax look at the file create_triggers.sql in your Auditor modules sql directory. You don’t need the {{PREFIX}} stuff just your table names and history database name. You can type these straight into a phpmyadmin sql window, you don’t have to do it as a script.

                    Use MODx, or the cat gets it!
                    • 27449
                    • 211 Posts
                    I get the history database and when I insert new information, this information already go for the history database smiley
                    but when I alter the information I obtain an error and the information doesn’t update on the oprc database and the oprc_history database :S
                    because doesn’t replay the primary key
                    Can will be for the tabelas it’s Innodb?
                      • 27449
                      • 211 Posts
                      thank you very much for your help smiley
                      I already to get