X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fupdate_test_schema%2Fupdate_test_schema.install;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fupdate_test_schema%2Fupdate_test_schema.install;h=972f9017616fedbddd1e1d53c46b3e5de41dab77;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install b/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install new file mode 100644 index 000000000..972f90176 --- /dev/null +++ b/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install @@ -0,0 +1,48 @@ +get('update_test_schema_version', 8000); + $table = [ + 'fields' => [ + 'a' => ['type' => 'int', 'not null' => TRUE], + 'b' => ['type' => 'blob', 'not null' => FALSE], + ], + ]; + switch ($schema_version) { + case 8001: + // Add the index. + $table['indexes']['test'] = ['a']; + break; + } + return ['update_test_schema_table' => $table]; +} + +// Update hooks are defined depending on state as well. +$schema_version = \Drupal::state()->get('update_test_schema_version', 8000); + +if ($schema_version >= 8001) { + /** + * Schema version 8001. + */ + function update_test_schema_update_8001() { + $table = [ + 'fields' => [ + 'a' => ['type' => 'int', 'not null' => TRUE], + 'b' => ['type' => 'blob', 'not null' => FALSE], + ], + ]; + + // Add a column. + db_add_index('update_test_schema_table', 'test', ['a'], $table); + } +}