diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-19 17:25:56 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-19 17:25:56 -0700 |
commit | 3b6f738ab73b7f77dd09ac21dd9446876776fc04 (patch) | |
tree | 5c05777f9d03a2d3b10462b58249b0d1ca79f235 /plugins | |
parent | 8b0ba03a2e924fc56440719af1d7564e562ba9c9 (diff) |
Convert SamplePlugin to new-style table defs, tweak some stuff to test basic checkschema
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 4 | ||||
-rw-r--r-- | plugins/Sample/SamplePlugin.php | 17 |
2 files changed, 16 insertions, 5 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 572b5ea07..4ba0a6c85 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -73,8 +73,8 @@ class Ostatus_profile extends Managed_DataObject 'ostatus_profile_feeduri_idx' => array('feeduri'), ), 'foreign keys' => array( - 'profile_id' => array('profile' => 'id'), - 'group_id' => array('user_group' => 'id'), + 'ostatus_profile_profile_id_fkey' => array('profile', array('profile_id' => 'id')), + 'ostatus_profile_group_id_fkey' => array('user_group', array('group_id' => 'id')), ), ); } diff --git a/plugins/Sample/SamplePlugin.php b/plugins/Sample/SamplePlugin.php index ef69121a9..a0d1140f3 100644 --- a/plugins/Sample/SamplePlugin.php +++ b/plugins/Sample/SamplePlugin.php @@ -172,9 +172,20 @@ class SamplePlugin extends Plugin // For storing user-submitted flags on profiles $schema->ensureTable('user_greeting_count', - array(new ColumnDef('user_id', 'integer', null, - true, 'PRI'), - new ColumnDef('greeting_count', 'integer'))); + array( + 'fields' => array( + 'user_id' => array('type' => 'int', 'not null' => true), + 'greeting_count' => array('type' => 'int'), + ), + 'primary key' => array('user_id'), + 'foreign keys' => array( + // Not all databases will support foreign keys, but even + // when not enforced it's helpful to include these definitions + // as documentation. + 'user_greeting_count_user_id_fkey' => array('user', array('user_id' => 'id')), + ), + ) + ); return true; } |