From b06128e81986b8e228fe77e3660c6315d747ab6d Mon Sep 17 00:00:00 2001 From: tracer Date: Tue, 30 Apr 2024 13:11:54 +0200 Subject: [PATCH] changed config table --- composer.json | 2 +- .../20240430111136_u_u_i_d_for_config.php | 41 ++++++++++++ db/migrations/schema.php | 66 ++++++++++++++++++- 3 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 db/migrations/20240430111136_u_u_i_d_for_config.php diff --git a/composer.json b/composer.json index 8420f60..894f150 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "24unix/bindapi", "description": "manage Bind9 DNS server via REST API", "version": "1.0.9", - "build_number": "361", + "build_number": "362", "authors": [ { "name": "Micha Espey", diff --git a/db/migrations/20240430111136_u_u_i_d_for_config.php b/db/migrations/20240430111136_u_u_i_d_for_config.php new file mode 100644 index 0000000..31ce35d --- /dev/null +++ b/db/migrations/20240430111136_u_u_i_d_for_config.php @@ -0,0 +1,41 @@ +table('config', [ + 'id' => false, + 'primary_key' => ['id'], + 'engine' => 'InnoDB', + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_general_ci', + 'comment' => '', + 'row_format' => 'DYNAMIC', + ]) + ->addColumn('id', 'uuid', [ + 'null' => false, + ]) + ->changeColumn('name', 'string', [ + 'null' => false, + 'limit' => 256, + 'collation' => 'utf8mb4_general_ci', + 'encoding' => 'utf8mb4', + 'after' => 'id', + ]) + ->changeColumn('value', 'string', [ + 'null' => false, + 'limit' => 256, + 'collation' => 'utf8mb4_general_ci', + 'encoding' => 'utf8mb4', + 'after' => 'name', + ]) + ->addIndex(['id'], [ + 'name' => 'id', + 'unique' => true, + ]) + ->save(); + } +} diff --git a/db/migrations/schema.php b/db/migrations/schema.php index 6de0a73..621c26f 100644 --- a/db/migrations/schema.php +++ b/db/migrations/schema.php @@ -112,12 +112,36 @@ return array ( ), 'columns' => array ( + 'id' => + array ( + 'TABLE_CATALOG' => 'def', + 'TABLE_NAME' => 'config', + 'COLUMN_NAME' => 'id', + 'ORDINAL_POSITION' => 1, + 'COLUMN_DEFAULT' => NULL, + 'IS_NULLABLE' => 'NO', + 'DATA_TYPE' => 'uuid', + 'CHARACTER_MAXIMUM_LENGTH' => NULL, + 'CHARACTER_OCTET_LENGTH' => NULL, + 'NUMERIC_PRECISION' => NULL, + 'NUMERIC_SCALE' => NULL, + 'DATETIME_PRECISION' => NULL, + 'CHARACTER_SET_NAME' => NULL, + 'COLLATION_NAME' => NULL, + 'COLUMN_TYPE' => 'uuid', + 'COLUMN_KEY' => 'PRI', + 'EXTRA' => '', + 'PRIVILEGES' => 'select,insert,update,references', + 'COLUMN_COMMENT' => '', + 'IS_GENERATED' => 'NEVER', + 'GENERATION_EXPRESSION' => NULL, + ), 'name' => array ( 'TABLE_CATALOG' => 'def', 'TABLE_NAME' => 'config', 'COLUMN_NAME' => 'name', - 'ORDINAL_POSITION' => 1, + 'ORDINAL_POSITION' => 2, 'COLUMN_DEFAULT' => NULL, 'IS_NULLABLE' => 'NO', 'DATA_TYPE' => 'varchar', @@ -129,7 +153,7 @@ return array ( 'CHARACTER_SET_NAME' => 'utf8mb4', 'COLLATION_NAME' => 'utf8mb4_general_ci', 'COLUMN_TYPE' => 'varchar(256)', - 'COLUMN_KEY' => 'PRI', + 'COLUMN_KEY' => 'UNI', 'EXTRA' => '', 'PRIVILEGES' => 'select,insert,update,references', 'COLUMN_COMMENT' => '', @@ -141,7 +165,7 @@ return array ( 'TABLE_CATALOG' => 'def', 'TABLE_NAME' => 'config', 'COLUMN_NAME' => 'value', - 'ORDINAL_POSITION' => 2, + 'ORDINAL_POSITION' => 3, 'COLUMN_DEFAULT' => NULL, 'IS_NULLABLE' => 'NO', 'DATA_TYPE' => 'varchar', @@ -163,6 +187,24 @@ return array ( ), 'indexes' => array ( + 'PRIMARY' => + array ( + 1 => + array ( + 'Table' => 'config', + 'Non_unique' => 0, + 'Key_name' => 'PRIMARY', + 'Seq_in_index' => 1, + 'Column_name' => 'id', + 'Collation' => 'A', + 'Sub_part' => NULL, + 'Packed' => NULL, + 'Null' => '', + 'Index_type' => 'BTREE', + 'Comment' => '', + 'Index_comment' => '', + ), + ), 'name' => array ( 1 => @@ -181,6 +223,24 @@ return array ( 'Index_comment' => '', ), ), + 'id' => + array ( + 1 => + array ( + 'Table' => 'config', + 'Non_unique' => 0, + 'Key_name' => 'id', + 'Seq_in_index' => 1, + 'Column_name' => 'id', + 'Collation' => 'A', + 'Sub_part' => NULL, + 'Packed' => NULL, + 'Null' => '', + 'Index_type' => 'BTREE', + 'Comment' => '', + 'Index_comment' => '', + ), + ), ), 'foreign_keys' => NULL, ),