function photos_schema in Album Photos 8.5
Same name and namespace in other branches
- 8.4 photos.install \photos_schema()
- 6.2 photos.install \photos_schema()
- 7.3 photos.install \photos_schema()
- 6.0.x photos.install \photos_schema()
Implements hook_schema().
File
- ./
photos.install, line 17 - Install, update, and uninstall functions for the Photos module.
Code
function photos_schema() {
// @todo migrate fid to {photos_image}.id cover_id.
// @todo migrate pid to album_id.
// @todo migrate wid to weight.
$schema['photos_album'] = [
'fields' => [
'album_id' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'cover_id' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'weight' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
'count' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'data' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
],
],
'indexes' => [
'cover_id' => [
'cover_id',
],
'weight' => [
'weight',
],
],
'primary key' => [
'album_id',
],
];
// @todo migrate photos_image to new photos_image entity.
// @todo migrate comments to new photos_image entity comment field.
// @todo migrate {photos_image}.count to {photos_count}. Note that
// {photso_count} is counting photos and {photos_image}.count is counting
// views.
// @todo look into core statistics API to replace or supplement photos_count?
// @see https://www.drupal.org/project/photos/issues/3101624
$schema['photos_count'] = [
'fields' => [
'id' => [
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'cid' => [
'type' => 'int',
'description' => 'Count entity id.',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'changed' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'type' => [
'type' => 'varchar',
'length' => 12,
'default' => '',
'not null' => TRUE,
],
'value' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'cid' => [
'cid',
],
'type' => [
'type',
],
'value' => [
'value',
],
],
'primary key' => [
'id',
],
];
return $schema;
}