You are here

function patchinfo_update_8203 in PatchInfo 8.2

Adds source_module field to primary index of patchinfo database table.

File

./patchinfo.install, line 113
Install, update, and uninstall functions for the Patch Info module.

Code

function patchinfo_update_8203() {
  $table = 'patchinfo';
  $index = 'PRIMARY';
  $field = 'source_module';
  $schema = Database::getConnection()
    ->schema();
  if ($schema) {
    if ($schema
      ->tableExists($table)) {
      if ($schema
        ->indexExists($table, $index)) {
        $schema
          ->dropIndex($table, $index);
      }
      if ($schema
        ->fieldExists($table, $field)) {
        $schema
          ->addPrimaryKey($table, [
          'source_module',
          'module',
          'id',
        ]);
      }
    }
  }
}