-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check database exist before create #329
Conversation
@@ -49,11 +49,6 @@ public static function getDatabase(): Database | |||
$database = new Database(new MariaDB($pdo), $cache); | |||
$database->setDefaultDatabase('utopiaTests'); | |||
$database->setNamespace('myapp_'.uniqid()); | |||
|
|||
if ($database->exists('utopiaTests')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove this, since it is Done in Base.php Tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you link it? I don't see a call to delete in Base.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
database/tests/Database/Base.php
Line 72 in 107a633
$this->assertEquals(true, static::getDatabase()->delete($this->testDatabase)); |
I guess I can revert this to be more consistent for a fresh start, not to depend on this exist method 👍
Do we need this change? Shouldn't it be okay as is with |
We had some lock incidents with the create schema, it is triggering a DDL operation, |
@fogelito I don't think this query was the one that held the lock, but the one that was blocked when trying to acquire it |
…abase-check � Conflicts: � src/Database/Adapter/MariaDB.php � src/Database/Adapter/SQL.php
src/Database/Adapter/MariaDB.php
Outdated
if ($this->exists($name)) { | ||
return true; | ||
} | ||
|
||
$sql = "CREATE DATABASE IF NOT EXISTS `{$name}` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sql = "CREATE DATABASE IF NOT EXISTS `{$name}` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;"; | |
$sql = "CREATE DATABASE `{$name}` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;"; |
With the new check we don't really need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we have the same in other adapters?
No description provided.