party_activity.install in Party 7
Same filename and directory in other branches
Install scripts and other things for the party activity module
File
modules/party_activity/party_activity.installView source
<?php
/**
* @file Install scripts and other things for the party activity module
*/
/**
* Implements hook_schema()
*/
function party_activity_schema() {
$schema['party_activity_type'] = array(
'description' => 'Stores information about Party Activity Types',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique Activity type identifier',
),
'type' => array(
'description' => 'The machine-readable name of this activity type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this activity type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'data' => array(
'description' => 'A serialized array of extra settings',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
'not null' => FALSE,
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'The weight of this model type in relation to others.',
),
) + entity_exportable_schema_fields(),
'primary key' => array(
'id',
),
'unique keys' => array(
'type' => array(
'type',
),
),
);
$schema['party_activity'] = array(
'description' => 'Stores information about Party Activities',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique Party Activity Identifier',
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'The title of this party activity',
'not null' => TRUE,
'default' => '',
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'Bundle Key: The type of aqctivity this is',
'not null' => TRUE,
'default' => '',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'When this activity was created',
),
'modified' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'When this activity was last modified',
),
'user' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The User ID of the the creator of this activity',
),
),
'primary key' => array(
'id',
),
'indexes' => array(
'type' => array(
'type',
),
),
'foreign keys' => array(
'user' => array(
'table' => 'users',
'columns' => array(
'user' => 'uid',
),
),
),
);
return $schema;
}
/**
* Change primary identifier for the activity.
*/
function party_activity_update_7001() {
db_drop_primary_key('party_activity');
db_change_field('party_activity', 'party_activity_id', 'id', array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique Party Activity Identifier',
), array(
'primary key' => array(
'id',
),
));
}
/**
* Add the data field to the party activity type table.
*/
function party_activity_update_7002() {
db_add_field('party_activity_type', 'data', array(
'description' => 'A serialized array of extra settings',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
'not null' => FALSE,
));
}
Functions
Name | Description |
---|---|
party_activity_schema | Implements hook_schema() |
party_activity_update_7001 | Change primary identifier for the activity. |
party_activity_update_7002 | Add the data field to the party activity type table. |