We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I’m mentaly working on a tutorial on build scripts, but I still can’t seem to get my head around exactly what these do and how to decide what they should be set to:

    XPDO_TRANSPORT_UNIQUE_KEY
    XPDO_TRANSPORT_UPDATE_OBJECT
    XPDO_TRANSPORT_PRESERVE_KEYS

    And, are there other attributes that should be covered in the tutorial?
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: BobRay at Dec 01, 2008, 06:35 PM

      XPDO_TRANSPORT_UNIQUE_KEY
      Optional attribute which defines a column or array of columns which identify a data object uniquely. If not specified, the primary key (i.e. native key) is used for lookups of existing objects in the target deployment.

      Quote from: BobRay at Dec 01, 2008, 06:35 PM

      XPDO_TRANSPORT_UPDATE_OBJECT
      Optional attribute which defines if existing objects should be updated or left alone if found in the target deployment. The default is false.

      Quote from: BobRay at Dec 01, 2008, 06:35 PM

      XPDO_TRANSPORT_PRESERVE_KEYS
      Optional attribute indicating if an object’s primary key should be preserved. If false, the key is discarded and a new one generated. Objects that do not preserve their keys must be able to generate their own keys (i.e. auto increment primary key value in MySQL). The default is true.

      Quote from: BobRay at Dec 01, 2008, 06:35 PM

      And, are there other attributes that should be covered in the tutorial?
      Likely; I’ll see if I can’t create a wiki page with additional information.
        • 3749
        • 24,544 Posts
        Thanks, that answers the first question. I’m still not sure, though, under what circumstances I would want to change the default values (except for UPGRADE, which is obvious even for me).

        Can you give some examples of cases where you’d want to change the defaults?

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 3749
          • 24,544 Posts
          Still wonding about this -- especially XPDO_TRANSPORT_PRESERVE_KEYS. I notice that XPDO_TRANSPORT_PRESERVE_KEYS is set to false in the Captcha package and UNIQUE_KEY is set to ’key’. I’m not sure if I did that or if splittingred did when he edited it.

          Will that cause any problems?  Should they be changed?


          Looking in SVN, I see that many components use the defaults, so XPDO_TRANSPORT_PRESERVE_KEYS is set to true, but a number of them have PRESERVE_KEYS set to false (e.g. ditto, weblogin). I have no idea why.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 28215
            • 4,149 Posts
            Quote from: BobRay at Dec 11, 2008, 11:30 PM

            Still wonding about this -- especially XPDO_TRANSPORT_PRESERVE_KEYS. I notice that XPDO_TRANSPORT_PRESERVE_KEYS is set to false in the Captcha package and UNIQUE_KEY is set to ’key’. I’m not sure if I did that or if splittingred did when he edited it.

            I did that, for the System Settings you are adding in - because the unique identifier for the system settings table isn’t ’name’, it’s ’key’ (there is no name field).

            Also, PRESERVE_KEYS is false in the actual plugin, because you don’t want to preserve the PK there...the PK is ’id’, and is an auto-increment SQL field. PRESERVE_KEYS should always be false when dealing with objects that use auto-increment fields. It’s true on the System Settings because we want those PKs (key) to stay the same as in the build.


            Looking in SVN, I see that many components use the defaults, so XPDO_TRANSPORT_PRESERVE_KEYS is set to true, but a number of them have PRESERVE_KEYS set to false (e.g. ditto, weblogin). I have no idea why.

            Most all the snippets use PRESERVE_KEYS set to false on their snippet or plugin objects; if they don’t, they’re wrong.
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 3749
              • 24,544 Posts
              Ok, so if I look at the object I’m creating or updating in the DB and see the PK with an auto_increment setting, PRESERVE_KEYS should be set to false?

              It looks like the Captcha build file doesn’t set PRESERVE_KEYS for the plugin, but looking at the xpdovehicle class code, it appears that the default is false. If Jason mistyped the default value in his message above, then those snippets I was talking about are ok and I’m less confused. wink

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting