From e8ff4cb781a57826b4dccdc99a2efde7c30410a9 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 20 Jun 2024 14:54:08 -0400 Subject: [PATCH] Only add table if not exists This is helpful to upgrade testers & also to sites that want to pre-add tables --- mixin/lib/civimix-schema/src/SqlGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mixin/lib/civimix-schema/src/SqlGenerator.php b/mixin/lib/civimix-schema/src/SqlGenerator.php index a4ef2f3f2178..64693daf83e0 100644 --- a/mixin/lib/civimix-schema/src/SqlGenerator.php +++ b/mixin/lib/civimix-schema/src/SqlGenerator.php @@ -87,7 +87,7 @@ public function getDropTablesSql(): string { public function generateCreateTableWithConstraintSql(array $entity): string { $definition = $this->getTableDefinition($entity); $constraints = $this->getTableConstraints($entity); - $sql = "CREATE TABLE `{$entity['table']}` (\n " . + $sql = "CREATE TABLE IF NOT EXISTS `{$entity['table']}` (\n " . implode(",\n ", $definition); if ($constraints) { $sql .= ",\n " . implode(",\n ", $constraints);