l10n_server-2.x-dev/l10n_migrate/tests/fixtures/localize7_l10n_server_status_flag.php

l10n_migrate/tests/fixtures/localize7_l10n_server_status_flag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
// phpcs:ignoreFile
/**
 * @file
 * A database agnostic dump for testing purposes.
 *
 * This file is based on one generated by the Drupal 10.1.5 db-tools.php
 * script.
 */
 
use Drupal\Core\Database\Database;
use Drupal\Tests\l10n_migrate\Kernel\MigrateL10nServerStatusFlagTest as MigrateL10nTestAlias;
 
$connection = Database::getConnection();
 
// Ensure any tables with a serial column with a value of 0 are created as
// expected.
if ($connection->databaseType() === 'mysql') {
  $sql_mode = $connection->query("SELECT @@sql_mode;")->fetchField();
  $connection->query("SET sql_mode = '$sql_mode,NO_AUTO_VALUE_ON_ZERO'");
}
 
$connection->schema()->createTable('l10n_server_status_flag', array(
  'fields' => array(
    'sid' => array(
      'type' => 'int',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'language' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '12',
    ),
    'has_suggestion' => array(
      'type' => 'int',
      'not null' => TRUE,
      'size' => 'normal',
      'default' => '0',
    ),
    'has_translation' => array(
      'type' => 'int',
      'not null' => TRUE,
      'size' => 'normal',
      'default' => '0',
    ),
  ),
  'primary key' => array(
    'sid',
    'language',
  ),
  'indexes' => array(
    'sid_language_has_suggestion' => array(
      'sid',
      'language',
      'has_suggestion',
    ),
    'sid_language_has_translation' => array(
      'sid',
      'language',
      'has_translation',
    ),
  ),
  'mysql_character_set' => 'utf8mb4',
));
 
$rows = MigrateL10nTestAlias::expectedDataTable();
foreach ($rows as $row) {
  $connection->insert('l10n_server_status_flag')
    ->fields(array_keys(current($rows)))
    ->values($row)
    ->execute();
}
 
// Reset the SQL mode.
if ($connection->databaseType() === 'mysql') {
  $connection->query("SET sql_mode = '$sql_mode'");
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc