summaryrefslogtreecommitdiff
path: root/plugins/Sample/SamplePlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Sample/SamplePlugin.php')
-rw-r--r--plugins/Sample/SamplePlugin.php17
1 files changed, 14 insertions, 3 deletions
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;
}