activity-8.x-1.x-dev/activity.install
activity.install
<?php /** * @file * Install, update and uninstall functions for the activity module. */ use Drupal\Core\Database\Schema; /** * Implements hook_schema(). */ function activity_schema() { $schema['activity_events'] = [ 'description' => 'Maps events to hook and operation assignments from activity module.', 'fields' => [ 'event_id' => [ 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => 'The Unique id of the message', ], 'hook' => [ 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'The name of hook, e.g. Save content.', ], 'label' => [ 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => "Primary Key: Action's label.", ], 'userId' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '10', 'not null' => TRUE, 'description' => "The user id.", ], 'created' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '11', 'not null' => TRUE, 'description' => "The time when the action is created.", ], 'message' => [ 'descripiton' => 'The full plaintext message.', 'type' => 'text', 'size' => 'big', 'not null' => FALSE, ], ], 'primary key' => ['event_id'], ]; $schema['activity'] = [ 'fields' => [ 'action_id' => [ 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => 'The Unique id of the message', ], 'event_id' => [ 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'The event id related to activity_events table.', ], 'entity_type' => [ 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'The entity type, e.g. node.', ], 'nid' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '10', 'not null' => FALSE, 'description' => "The node id.", ], 'uid' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '10', 'not null' => FALSE, 'description' => "The user id.", ], 'created' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '11', 'not null' => TRUE, 'description' => "The time when the action is created.", ], 'status' => [ 'type' => 'int', 'unsigned' => TRUE, 'disp-width' => '10', 'not null' => TRUE, 'description' => "The status.", ], 'message' => [ 'descripiton' => 'The full plaintext message', 'type' => 'text', 'size' => 'big', 'not null' => TRUE, ], ], 'primary key' => ['action_id'], ]; return $schema; } /** * Implements hook_uninstall_schema(). */ function activity_uninstall_schema($module) { $schema = drupal_get_module_schema($module); _drupal_schema_initialize($schema, $module, FALSE); foreach ($schema as $table) { if (Schema::tableExists('activity_events')) { Schema::dropTable('activity_events'); } if (Schema::tableExists('activity')) { Schema::dropTable('activity'); } } }