Results
14.02.2018
activity 8.x-1.x-dev ::
activity.install
*/ 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')) {
02.11.2019
admin_ui 8.x-1.x-dev ::
modules/jsonapi_tables/src/EntityTypeTableSchemaTrait.php
*/ protected static function getEntityTypeSchema(EntityTypeInterface $entity_type) { return drupal_get_module_schema($entity_type->get('table_provider'), $entity_type->getBaseTable()); } /** * Gets the primary key for the table of entity type. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
01.10.2020
message_thread 8.x-1.x-dev ::
message_thread.install
$schema_manager = Database::getConnection()->schema(); $schema = drupal_get_module_schema('message_thread'); $schema_manager->createTable('message_thread_statistics', $schema['message_thread_statistics']); } /** * Implements hook_update_N(). *
05.08.2020
searchindex_wipe 8.x-1.7 ::
searchindex_wipe.module
function searchindex_wipe_truncate_table() { // Taken code from drupal_uninstall_schema. $schema = drupal_get_module_schema('search'); foreach ($schema as $table_name => $table) { // Truncate search related tables. \Drupal::database()->truncate($table_name)->execute(); } \Drupal::messenger()->addMessage(t('Search Index Cleared, Please rebuilt the index by running cron.')); }
05.02.2020
simpletest 8.x-3.x-dev ::
src/Tests/KernelTestBaseTest.php
$this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found."); $schema = drupal_get_module_schema($module, $table); $this->assertTrue($schema, "'$table' table schema found."); } /** * Tests installing modules with DependencyInjection services. */
// Verify that the schema is known to Schema API. $schema = drupal_get_module_schema($module, $table); $this->assertTrue($schema, "'$table' table schema found."); // Verify that a unknown table from an enabled module throws an error. $table = 'unknown_entity_test_table'; try { $this->installSchema($module, $table);
$this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found."); $schema = drupal_get_module_schema($module, $table); $this->assertFalse($schema, "'$table' table schema not found."); // Verify that a table from a unknown module cannot be installed. $module = 'database_test'; $table = 'test'; try {
$this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found."); $schema = drupal_get_module_schema($module, $table); $this->assertTrue($schema, "'$table' table schema found."); // Verify that the same table can be installed after enabling the module. $this->enableModules([$module]); $this->installSchema($module, $table); $this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found.");
$this->installSchema($module, $table); $this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found."); $schema = drupal_get_module_schema($module, $table); $this->assertTrue($schema, "'$table' table schema found."); } /** * Tests expected behavior of installEntitySchema(). */
05.02.2020
simpletest 8.x-3.x-dev ::
src/KernelTestBase.php
*/ protected function installSchema($module, $tables) { // drupal_get_module_schema() is technically able to install a schema // of a non-enabled module, but its ability to load the module's .install // file depends on many other factors. To prevent differences in test // behavior and non-reproducible test failures, we only allow the schema of // explicitly loaded/enabled modules to be installed. if (!$this->container->get('module_handler')->moduleExists($module)) { throw new \RuntimeException("'$module' module is not enabled");
$tables = (array) $tables; foreach ($tables as $table) { $schema = drupal_get_module_schema($module, $table); if (empty($schema)) { // BC layer to avoid some contrib tests to fail. // @todo Remove the BC layer before 8.1.x release. // @see https://www.drupal.org/node/2670360 // @see https://www.drupal.org/node/2670454 if ($module == 'system') {
19.07.2018
stockapi 8.x-2.x-dev ::
stockapi.inc
function _stockapi_fix_floats($stock) { $stock = (array) $stock; $schema = drupal_get_module_schema('stockapi'); foreach ($schema['fields'] as $name => $field) { if ($field['type'] == 'float' && isset($stock[$name]) && !is_numeric($stock[$name])) { $stock[$name] = 0; } }
03.09.2020
acknowledgements 8.x-1.0-beta11 ::
sign_for_acknowledgement.install
$table = 'sign_for_acknowledgement'; $field = 'alternate'; $tableSchema = drupal_get_module_schema('sign_for_acknowledgement', $table); $dbSchema = Database::getConnection()->schema(); $dbSchema->changeField($table, $field, $field, $tableSchema['fields'][$field]); if (!$dbSchema->indexExists($table, 'nid_uid')) { $dbSchema->addIndex($table, 'nid_uid', array('node_id', 'user_id'), $tableSchema); } if (!$dbSchema->indexExists($table, 'mydate')) {
$table = 'sign_for_acknowledgement_email'; $tableSchema = drupal_get_module_schema('sign_for_acknowledgement', $table); if (!$dbSchema->indexExists($table, 'nid_uid')) { $dbSchema->addIndex($table, 'nid_uid', array('node_id', 'user_id'), $tableSchema); } if (!$dbSchema->indexExists($table, 'mydate')) { $dbSchema->addIndex($table, 'mydate', array('mydate'), $tableSchema); }
else { $table_schema = drupal_get_module_schema('sign_for_acknowledgement', $table_name); $schema->createTable($table_name, $table_schema); } } /** * Implements hook_install().
21.07.2020
denormalizer 8.x-1.x-dev ::
src/Denormalizer.php
public function generateQuery($denormalizer_view, array $dn_info) { $d = denormalizer_get_info(); $schema = drupal_get_module_schema($d[$denormalizer_view]['schema_module'], $d[$denormalizer_view]['base table']); $property_info = []; if (isset($dn_info['entity_type'])) { $injected_database = Database::getConnection(); if ($dn_info['entity_type'] !== 'webform_submission') { $property_info = \Drupal::service('entity_field.manager') ->getBaseFieldDefinitions($dn_info['entity_type']);
21.07.2020
denormalizer 8.x-1.x-dev ::
denormalizer.module
// Drupal defined table. // Replaced "$d['schema_module']" by "$d[$dn_table]['schema_module']". $schema = drupal_get_module_schema($d[$dn_table]['schema_module'], $d[$dn_table]['base table']); if (isset($schema['primary key']) && count($schema['primary key']) == 1) { return $schema['primary key'][0]; } if (isset($dn_info['surrogate key'])) { return $dn_info['surrogate key'];
19.05.2022
monster_menus 9.0.x-dev ::
misc.inc
/** * Replacement for the deprecated drupal_get_module_schema() function. Returns * the schema for a particular table, or all tables, taken from hook_install() * in monster_menus.install. * * @param $table * If set, return the schema for a particular table, otherwise all tables. * @return array
15.07.2020
shorten 8.x-2.x-dev ::
modules/record_shorten/record_shorten.install
*/ function record_shorten_update_8001() { $schema = drupal_get_module_schema('record_shorten', 'record_shorten'); $schema['fields']['original']['length'] = 1024; Database::getConnection()->schema()->changeField('record_shorten', 'original', 'original', $schema['fields']['original']); }
17.05.2020
tether_stats 8.x-1.03 ::
src/Form/TetherStatsSettingsForm.php
$tables_exist = TRUE; $schema = drupal_get_module_schema('tether_stats'); foreach ($schema as $name => $table) { if (!$connection->schema()->tableExists($name)) { $tables_exist = FALSE; break;