Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let Plugins define Schema changes #4204

Closed
mattab opened this issue Oct 8, 2013 · 4 comments
Closed

Let Plugins define Schema changes #4204

mattab opened this issue Oct 8, 2013 · 4 comments
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Oct 8, 2013

Plugin developers can create new tables in the database, or alter existing tables to add fields.

In this process, it is common requirement to also maintain schema versioning for plugins. Piwik plugins have this built in.

The schema version is the same as the plugin version. When you release a new plugin version you can bundle with it some schema changes.

How to do this:

  • If your plugin has schama changes in version 1.13, create a file in plugins/MyPlugin/Updates/1.13.php
  • This file contains a Updates_1_13 class
  • This class can run PHP code during the update, and you can implement the getSql() method to return sql code to execute.

See an example of Plugin Schema Update in the DevicesDetection plugin here.

@mattab
Copy link
Member Author

mattab commented Oct 8, 2013

In 16f8dd6: Fixes #4203 DevicesDetection 1.14 version schema update to account for longer strings ( fields config_os_version and config_device_type are not large enough )

Refs #4204 Plugin schema example with DevicesDetection

@mattab
Copy link
Member Author

mattab commented Oct 8, 2013

In ded987a: Fixes #4203 DevicesDetection 1.14 version schema update to account for longer strings ( fields config_os_version and config_device_type are not large enough )
Refs #4204 Plugin schema example with DevicesDetection

@mattab
Copy link
Member Author

mattab commented Oct 8, 2013

In bbb8642: Refs #4204 Fix logic bug: setting Plugin schema version after they were successfully installed + should fix the build (thx ArchiveCronTest)

@mattab
Copy link
Member Author

mattab commented Oct 9, 2013

In 20cdfcf: Refs #4204

@mattab mattab added this to the 2.0 - Piwik 2.0 milestone Jul 8, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
…account for longer strings ( fields config_os_version and config_device_type are not large enough )

Refs matomo-org#4204 Plugin schema example with DevicesDetection
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
…account for longer strings ( fields config_os_version and config_device_type are not large enough )

Refs matomo-org#4204 Plugin schema example with DevicesDetection
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
…er they were successfully installed + should fix the build (thx ArchiveCronTest)
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

1 participant