5 * Install, update and uninstall functions for the database_test module.
9 * Implements hook_schema().
11 * The database tests use the database API which depends on schema
12 * information for certain operations on certain databases.
13 * Therefore, the schema must actually be declared in a normal module
14 * like any other, not directly in the test file.
16 function database_test_schema() {
18 'description' => 'Basic test table for the database unit tests.',
26 'description' => "A person's name",
27 'type' => 'varchar_ascii',
34 'description' => "The person's age",
41 'description' => "The person's job",
45 'default' => 'Undefined',
48 'primary key' => ['id'],
57 // This is an alternate version of the same table that is structured the same
58 // but has a non-serial Primary Key.
59 $schema['test_people'] = [
60 'description' => 'A duplicate version of the test table, used for additional tests.',
63 'description' => "A person's name",
70 'description' => "The person's age",
77 'description' => "The person's job",
78 'type' => 'varchar_ascii',
84 'primary key' => ['job'],
90 $schema['test_people_copy'] = [
91 'description' => 'A duplicate version of the test_people table, used for additional tests.',
94 'description' => "A person's name",
101 'description' => "The person's age",
108 'description' => "The person's job",
109 'type' => 'varchar_ascii',
115 'primary key' => ['job'],
121 $schema['test_one_blob'] = [
122 'description' => 'A simple table including a BLOB field for testing BLOB behavior.',
125 'description' => 'Simple unique ID.',
130 'description' => 'A BLOB field.',
134 'primary key' => ['id'],
137 $schema['test_two_blobs'] = [
138 'description' => 'A simple test table with two BLOB fields.',
141 'description' => 'Simple unique ID.',
146 'description' => 'A dummy BLOB field.',
150 'description' => 'A second BLOB field.',
154 'primary key' => ['id'],
157 $schema['test_task'] = [
158 'description' => 'A task list for people in the test table.',
161 'description' => 'Task ID, primary key.',
166 'description' => 'The {test_people}.pid, foreign key for the test table.',
173 'description' => 'The task to be completed.',
180 'description' => 'The priority of the task.',
187 'primary key' => ['tid'],
190 $schema['test_null'] = [
191 'description' => 'Basic test table for NULL value handling.',
199 'description' => "A person's name.",
200 'type' => 'varchar_ascii',
206 'description' => "The person's age.",
213 'primary key' => ['id'],
222 $schema['test_serialized'] = [
223 'description' => 'Basic test table for NULL value handling.',
231 'description' => "A person's name.",
232 'type' => 'varchar_ascii',
238 'description' => "The person's data in serialized form.",
243 'primary key' => ['id'],
249 $schema['test_composite_primary'] = [
250 'description' => 'Basic test table with a composite primary key',
253 'description' => "A person's name",
261 'description' => "The person's age",
268 'description' => "The person's job",
272 'default' => 'Undefined',
275 'primary key' => ['name', 'age'],
278 $schema['test_special_columns'] = [
279 'description' => 'A simple test table with special column names.',
282 'description' => 'Simple unique ID.',
287 'description' => 'A column with preserved name.',
291 'primary key' => ['id'],
294 $schema['TEST_UPPERCASE'] = $schema['test'];