function locale_update_8015

Build a new {locale_file} table.

Related topics

File

drupal/core/modules/locale/locale.install, line 886
Install, update, and uninstall functions for the Locale module.

Code

function locale_update_8015() {

  // The existing table has a primary key on uri and langcode. The new key
  // is on project and langcode. There is no project data in the existing table,
  // and it may not be possible to generate this reliably. Therefore we drop
  // the table and build it again.
  db_drop_table('locale_file');
  $table = array(
    'description' => 'File import status information for interface translation files.',
    'fields' => array(
      'project' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'A unique short name to identify the project the file belongs to.',
      ),
      'langcode' => array(
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Language code of this translation. References {language}.langcode.',
      ),
      'filename' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Filename of the imported file.',
      ),
      'version' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Version tag of the imported file.',
      ),
      'uri' => array(
        'description' => 'File system path for importing the file.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
        'description' => 'Unix timestamp of the imported file.',
      ),
      'last_checked' => array(
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
        'description' => 'Unix timestamp of the last time this translation was confirmed to be the most recent release available.',
      ),
    ),
    'primary key' => array(
      'project',
      'langcode',
    ),
  );
  db_create_table('locale_file', $table);
}