Plugin schema changes

From StatusNet
Jump to: navigation, search

There is a new event, 'CheckSchema'. Plugin developers can hook this event to check the schema for your plugin at the "right" time. A typical example:

   function onCheckSchema() {
       $schema = Schema::get();
       $schema->ensureTable('person',
                            array(new ColumnDef('id', 'integer', null, false, 'PRI'),
                                  new ColumnDef('name', 'varchar', 255),
                                  new ColumnDef('picture', 'blob'),
                                  new ColumnDef('age', 'integer', null, true, null, 25)));
       return true;
   }

You can see the constructor params for ColumnDef in lib/schema.php.

This is currently run either on every page view or only when checkschema.php is run, depending on configuration; once a plugin installation interface is ready, the event should fire on plugin activation.

http://lists.status.net/pipermail/statusnet-dev/2009-October/002436.html

Personal tools
Namespaces
Variants
Actions
Navigation
Status.net
Toolbox