From d549831883c8f58b52f390bbf4e905825d26fdd6 Mon Sep 17 00:00:00 2001 From: Sohel Ahmed Mesaniya Date: Mon, 18 Nov 2024 19:16:38 +0530 Subject: [PATCH] Implement for table/compo schema - WIP --- src/lib/AttributeResolver.php | 1 + src/lib/items/DbModel.php | 2 ++ src/lib/migrations/MysqlMigrationBuilder.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/lib/AttributeResolver.php b/src/lib/AttributeResolver.php index 92014c6e..736844cb 100644 --- a/src/lib/AttributeResolver.php +++ b/src/lib/AttributeResolver.php @@ -117,6 +117,7 @@ public function resolve(): DbModel //For valid primary keys for junction tables 'junctionCols' => $this->isJunctionSchema ? $this->junctions->junctionCols($this->schemaName) : [], 'isNotDb' => $this->componentSchema->isNonDb(), + 'descriptionIsComment' => $this->componentSchema->{CustomSpecAttr::DESC_IS_COMMENT}, ], ]); } diff --git a/src/lib/items/DbModel.php b/src/lib/items/DbModel.php index 1deb9fbc..08135d71 100644 --- a/src/lib/items/DbModel.php +++ b/src/lib/items/DbModel.php @@ -88,6 +88,8 @@ class DbModel extends BaseObject */ public $scenarioDefaultDescription = "Scenario {scenarioName}"; + public bool $descriptionIsComment = false; + /** * @var array Automatically generated scenarios from the model 'x-scenarios'. */ diff --git a/src/lib/migrations/MysqlMigrationBuilder.php b/src/lib/migrations/MysqlMigrationBuilder.php index b31a7619..50947555 100644 --- a/src/lib/migrations/MysqlMigrationBuilder.php +++ b/src/lib/migrations/MysqlMigrationBuilder.php @@ -66,6 +66,8 @@ protected function compareColumns(ColumnSchema $current, ColumnSchema $desired): ]; if (!empty($this->config->getOpenApi()->{CustomSpecAttr::DESC_IS_COMMENT})) { $properties[] = 'comment'; + } elseif ($this->model->descriptionIsComment) { // TODO + $properties[] = 'comment'; } foreach ($properties as $attr) { if ($attr === 'defaultValue') {