From e4f5a4a07ef2ed2a510dc2758f23d1b82340f05e Mon Sep 17 00:00:00 2001 From: tracer Date: Fri, 19 Apr 2024 15:50:12 +0200 Subject: [PATCH] modified apikeys table --- composer.json | 2 +- composer.lock | 98 +++++++++---------- ...9134939_time_stamp_defaultfor_api_keys.php | 25 +++++ db/migrations/schema.php | 4 +- src/Repository/SettingsRepository.php | 2 +- 5 files changed, 77 insertions(+), 54 deletions(-) create mode 100644 db/migrations/20240419134939_time_stamp_defaultfor_api_keys.php diff --git a/composer.json b/composer.json index e8a5fcb..36aec7f 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.7", - "build_number": "345", + "build_number": "346", "authors": [ { "name": "Micha Espey", diff --git a/composer.lock b/composer.lock index 86bcec7..10d0632 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "06c636117e4391261d02c4bf3a2f356d", + "content-hash": "39a97c9f763fcd937f90143307fa8185", "packages": [ { "name": "arubacao/tld-checker", - "version": "1.2.227", + "version": "1.2.228", "source": { "type": "git", "url": "https://github.com/arubacao/tld-checker.git", - "reference": "aee43babd8548eb407923002a5c978d9a95ec409" + "reference": "2b203b2ceac5bad62fed07f1613c9cf118fe6f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/arubacao/tld-checker/zipball/aee43babd8548eb407923002a5c978d9a95ec409", - "reference": "aee43babd8548eb407923002a5c978d9a95ec409", + "url": "https://api.github.com/repos/arubacao/tld-checker/zipball/2b203b2ceac5bad62fed07f1613c9cf118fe6f96", + "reference": "2b203b2ceac5bad62fed07f1613c9cf118fe6f96", "shasum": "" }, "require": { @@ -65,9 +65,9 @@ ], "support": { "issues": "https://github.com/arubacao/tld-checker/issues", - "source": "https://github.com/arubacao/tld-checker/tree/1.2.227" + "source": "https://github.com/arubacao/tld-checker/tree/1.2.228" }, - "time": "2024-04-07T04:01:17+00:00" + "time": "2024-04-14T04:01:22+00:00" }, { "name": "cakephp/chronos", @@ -515,16 +515,16 @@ }, { "name": "monolog/monolog", - "version": "3.5.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448" + "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c915e2634718dbc8a4a15c61b0e62e7a44e14448", - "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", + "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", "shasum": "" }, "require": { @@ -547,7 +547,7 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^10.1", + "phpunit/phpunit": "^10.5.17", "predis/predis": "^1.1 || ^2", "ruflin/elastica": "^7", "symfony/mailer": "^5.4 || ^6", @@ -600,7 +600,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.5.0" + "source": "https://github.com/Seldaek/monolog/tree/3.6.0" }, "funding": [ { @@ -612,7 +612,7 @@ "type": "tidelift" } ], - "time": "2023-10-27T15:32:31+00:00" + "time": "2024-04-12T21:02:21+00:00" }, { "name": "netresearch/jsonmapper", @@ -1194,47 +1194,46 @@ }, { "name": "symfony/console", - "version": "v6.4.6", + "version": "v7.0.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a2708a5da5c87d1d0d52937bdeac625df659e11f" + "reference": "fde915cd8e7eb99b3d531d3d5c09531429c3f9e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a2708a5da5c87d1d0d52937bdeac625df659e11f", - "reference": "a2708a5da5c87d1d0d52937bdeac625df659e11f", + "url": "https://api.github.com/repos/symfony/console/zipball/fde915cd8e7eb99b3d531d3d5c09531429c3f9e5", + "reference": "fde915cd8e7eb99b3d531d3d5c09531429c3f9e5", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^6.4|^7.0" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -1268,7 +1267,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.6" + "source": "https://github.com/symfony/console/tree/v7.0.6" }, "funding": [ { @@ -1284,7 +1283,7 @@ "type": "tidelift" } ], - "time": "2024-03-29T19:07:53+00:00" + "time": "2024-04-01T11:04:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2297,16 +2296,16 @@ }, { "name": "zircote/swagger-php", - "version": "4.8.7", + "version": "4.9.0", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "2357fafbb084be0f9eda7b5c1a659704fed65b28" + "reference": "b46a36d006f4db4d761995a5add1e7ab0386ed1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/2357fafbb084be0f9eda7b5c1a659704fed65b28", - "reference": "2357fafbb084be0f9eda7b5c1a659704fed65b28", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/b46a36d006f4db4d761995a5add1e7ab0386ed1d", + "reference": "b46a36d006f4db4d761995a5add1e7ab0386ed1d", "shasum": "" }, "require": { @@ -2372,9 +2371,9 @@ ], "support": { "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/4.8.7" + "source": "https://github.com/zircote/swagger-php/tree/4.9.0" }, - "time": "2024-03-23T06:35:46+00:00" + "time": "2024-04-18T22:32:11+00:00" } ], "packages-dev": [ @@ -2556,16 +2555,16 @@ }, { "name": "odan/phinx-migrations-generator", - "version": "6.1.1", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/odan/phinx-migrations-generator.git", - "reference": "167447e716935c6bffbde8ce86b6baeb3ce55f29" + "reference": "93aa47086d8aa513ac60447838455b51c940227a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/odan/phinx-migrations-generator/zipball/167447e716935c6bffbde8ce86b6baeb3ce55f29", - "reference": "167447e716935c6bffbde8ce86b6baeb3ce55f29", + "url": "https://api.github.com/repos/odan/phinx-migrations-generator/zipball/93aa47086d8aa513ac60447838455b51c940227a", + "reference": "93aa47086d8aa513ac60447838455b51c940227a", "shasum": "" }, "require": { @@ -2573,8 +2572,7 @@ "ext-pdo": "*", "php": "~8.1 || ~8.2", "riimu/kit-phpencoder": "^2.4", - "robmorgan/phinx": "^0.15.2", - "symfony/console": "^6" + "robmorgan/phinx": "^0.15.2 | ^0.16" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3", @@ -2608,9 +2606,9 @@ ], "support": { "issues": "https://github.com/odan/phinx-migrations-generator/issues", - "source": "https://github.com/odan/phinx-migrations-generator/tree/6.1.1" + "source": "https://github.com/odan/phinx-migrations-generator/tree/6.2.0" }, - "time": "2024-04-11T15:35:30+00:00" + "time": "2024-04-13T07:45:13+00:00" }, { "name": "phar-io/manifest", diff --git a/db/migrations/20240419134939_time_stamp_defaultfor_api_keys.php b/db/migrations/20240419134939_time_stamp_defaultfor_api_keys.php new file mode 100644 index 0000000..c7988dd --- /dev/null +++ b/db/migrations/20240419134939_time_stamp_defaultfor_api_keys.php @@ -0,0 +1,25 @@ +table('apikeys', [ + 'id' => false, + 'primary_key' => ['id'], + 'engine' => 'InnoDB', + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'comment' => '', + 'row_format' => 'DYNAMIC', + ]) + ->changeColumn('created_at', 'timestamp', [ + 'null' => true, + 'default' => 'current_timestamp()', + 'after' => 'apikey', + ]) + ->save(); + } +} diff --git a/db/migrations/schema.php b/db/migrations/schema.php index 347830e..a3f403a 100644 --- a/db/migrations/schema.php +++ b/db/migrations/schema.php @@ -927,8 +927,8 @@ return array ( 'TABLE_NAME' => 'apikeys', 'COLUMN_NAME' => 'created_at', 'ORDINAL_POSITION' => 5, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', + 'COLUMN_DEFAULT' => 'current_timestamp()', + 'IS_NULLABLE' => 'YES', 'DATA_TYPE' => 'timestamp', 'CHARACTER_MAXIMUM_LENGTH' => NULL, 'CHARACTER_OCTET_LENGTH' => NULL, diff --git a/src/Repository/SettingsRepository.php b/src/Repository/SettingsRepository.php index 68ea2dc..49afbda 100644 --- a/src/Repository/SettingsRepository.php +++ b/src/Repository/SettingsRepository.php @@ -47,7 +47,7 @@ readonly class SettingsRepository ON DUPLICATE KEY UPDATE value = :value "; - + try { $statement = $this->databaseConnection->getConnection()->prepare(query: $sql); $statement->bindParam(param: ':name', var: $name);