We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27376
    • 576 Posts
    Here’s another one of my somewhat great, possibly ridiculous ideas. But first, the scenario:

    I have my live site and development site, use TVs extensively (45 total). I often found it difficult to synchronize the live and development sites because of this. Here’s the reason why:

    The Primary Key of the [tt]site_tmplvar_contentvalues[/tt] is an arbitrary column: [tt]id[/tt]. So if, for instance changes have been made to the live site, new TV contents have been added, and an id tag added to each, but I then also have made changes/additions of a different nature to other TV contents on my development site, those will possibly receive the same id tag. So when synchronization time comes, there’s a conflict.

    I’m using Navicat to synchronize the two databases.

    This problem still exists in 0.9.7, unless the plan for MODx is to create processors that check for this kind of conflict. In which case I will shut up rolleyes

    What I propose is that we drop the ’id’ column in the table, and have [tt]tmplvarid[/tt] & [tt]contentid[/tt] form the Primary key, I have somewhat tested this in xPDO and it appears to work fine.

    -- An example of what I mean (don't actually execute this)
    ALTER TABLE `modx_site_tmplvar_contentvalues` DROP `id`;
    ALTER TABLE `modx_site_tmplvar_contentvalues` ADD PRIMARY KEY ( `tmplvarid` , `contentid` );


    I have no idea how this will affect MODx in the long run, nor do I know how difficult it would be to implement in the next release of MODx (0.9.7). What do you think?
      • 22303 MODX Staff
      • 10,725 Posts
      I agree it should be the way you propose. My only concern is that the vision for 0.9.7 was to maintain the upgrade path for people who have custom components that rely on the current database schema, and deprecate the use of direct SQL in components that touch core tables altogether in this release. Then, with subsequent releases begin changing the database structures; both to address issues such as this, as well as to get to the 1.0 model which will absolutely not work with custom components that rely on direct SQL to the current table structures.

      undecided
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: sirlancelot at May 29, 2007, 04:10 PM

        The Primary Key of the [tt]site_tmplvar_contentvalues[/tt] is an arbitrary column: [tt]id[/tt]. So if, for instance changes have been made to the live site, new TV contents have been added, and an id tag added to each, but I then also have made changes/additions of a different nature to other TV contents on my development site, those will possibly receive the same id tag. So when synchronization time comes, there’s a conflict.
        One thing I typically do, and I know, it’s definitely not optimal, but...

        Export the table data using the complete and extended options on the inserts, then simply use a text editor with column editing support or macros to remove the ’id’ field along with the corresponding first value and comma in each insert.

        I don’t know why phpMyAdmin has not provided options to export as complete inserts without auto_increment fields included... huh baffling
          • 27376
          • 576 Posts
          Thanks for putting it in perspective Jason! I sometimes forget we have such a large community that making changes like this require a lot of collaboration and time.

          Good to know we have similary visions wink