Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Let Plugins define Schema changes #4204

Closed
mattab opened this Issue · 4 comments

1 participant

Matthieu Aubry
Matthieu Aubry
Owner

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.

Matthieu Aubry
Owner

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

Matthieu Aubry
Owner

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

Matthieu Aubry
Owner

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

Matthieu Aubry
Owner

In 20cdfcf: Refs #4204

Matthieu Aubry mattab added this to the 2.0 - Piwik 2.0 milestone
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Fixes #4203 DevicesDetection 1.14 version schema update to account fo…
…r longer strings ( fields config_os_version and config_device_type are not large enough )

Refs #4204 Plugin schema example with DevicesDetection
16f8dd6
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Fixes #4203 DevicesDetection 1.14 version schema update to account fo…
…r longer strings ( fields config_os_version and config_device_type are not large enough )

Refs #4204 Plugin schema example with DevicesDetection
ded987a
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4204 Fix logic bug: setting Plugin schema version after they we…
…re successfully installed + should fix the build (thx ArchiveCronTest)
bbb8642
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4204 20cdfcf
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.