1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Database Updates

Discussion in 'XenForo Development Discussions' started by Naatan, Mar 23, 2012.

  1. Naatan

    Naatan Well-Known Member

    So for a while now I've been pondering how to manage database changes for a project I'm working on that will have multiple environments for development and testing before a change ends up on the live environment.

    If you've done any large scale work you've probably worked with versioning systems and you probably also know that versioning a MySQL database is not an easy task, simply because the data is not stored in such a way that you can easily differ an old data set with a new one. There's all sorts of solutions out there but none that really work in a plug-and-play sort of way, all require the program that uses the database to help out a bit, or they require you as a developer to perform a lot of manual labour determining what should be versioned and what shouldn't.

    Now XenForo does a good job providing you with a means of versioning a lot of your data through addons. An addon exports to XML which you can very easily use within your versioning system. However not every aspect of XF can be related to an addon and so not every part is so easily versioned. For example say I want to add a bunch of new usergroups and upgrades, XenForo does not have a solution to easily extract, version and import this sort of data.

    So to boil down to the actual subject of this discussion, I would love to know whether there are others here that face or have faced this challenge, and what they are doing about it.

    I have many ideas but they all have their own problems. In an ideal world I'd just be able to say "extract that usergroup and those permissions" and likewise "import them" into a different environment. It would be very hard to add such a feature for every single dataset in XenForo though.

    Would love to also hear Kier and Mike's views on the matter, as it is a problem they must often face themselves as well.
    guiltar likes this.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can go by the version of the addon itself. The install callback function can have two parameters:

    	public static function install($existingAddOn, $addOnData)
    		// NEW VERSION
    		// $addOnData['version_id']
    		// $existingAddOn['version_id']
    You can check the versions to run appropriate steps during an install / upgrade.
  3. Naatan

    Naatan Well-Known Member

    I appreciate your response Jake, but I'm not trying to discuss the update mechanisms of addons, as you can tell by reading the entire message.

Share This Page