You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -398,7 +398,7 @@ User:
398
398
`NOT NULL`in DB migrations is determined by `nullable` and `required` properties of the OpenAPI schema.
399
399
e.g. attribute = 'my_property'.
400
400
401
-
- If you define attribute neither "required" nor via "nullable", then it is by default `NULL`:
401
+
- If you define attribute neither "required" nor via "nullable", then it is by default `NULL` ([opposite of OpenAPI spec](https://swagger.io/specification/v3/?sbsearch=nullable)):
Copy file name to clipboardExpand all lines: src/lib/ColumnToCode.php
+3-2
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ class ColumnToCode
69
69
* @var bool
70
70
* Built In Type means the \cebe\yii2openapi\lib\items\Attribute::$type or \cebe\yii2openapi\lib\items\Attribute::$dbType is in list of Yii abstract data type list or not. And if is found we can use \yii\db\SchemaBuilderTrait methods to build migration instead of putting raw SQL
71
71
*/
72
-
private$isBuiltinType = false;
72
+
public$isBuiltinType = false;
73
73
74
74
/**
75
75
* @var bool
@@ -384,6 +384,7 @@ private function getIsBuiltinType($type, $dbType)
384
384
if ($this->isEnum()) {
385
385
returnfalse;
386
386
}
387
+
387
388
if ($this->fromDb === true) {
388
389
returnisset(
389
390
(newColumnSchemaBuilder(''))->categoryMap[$type]
@@ -465,7 +466,7 @@ private function resolveDefaultValue():void
465
466
466
467
privatefunctionisDefaultAllowed():bool
467
468
{
468
-
// default expression with parenthases is allowed
469
+
// default expression with parentheses is allowed
469
470
if ($this->column->defaultValueinstanceof \yii\db\Expression) {
Copy file name to clipboardExpand all lines: tests/specs/issue_fix/wrong_migration_for_pgsql_is_generated_for_string_varchar_datatype_149/app/migrations_pgsql_db/m200000_000000_change_table_fruits.php
-2
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,10 @@ class m200000_000000_change_table_fruits extends \yii\db\Migration
Copy file name to clipboardExpand all lines: tests/specs/x_db_type/edit_column/pgsql/app/migrations_pgsql_db/m200000_000001_change_table_editcolumns.php
+2-2
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,6 @@ public function safeUp()
14
14
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "name" SET DATA TYPE varchar(254)')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "numeric_col" SET DATA TYPE double precision USING "numeric_col"::double precision')->execute();
27
+
$this->alterColumn('{{%editcolumns}}', 'numeric_col', "SET NOT NULL");
Copy file name to clipboardExpand all lines: tests/specs/x_db_type/new_column/pgsql/app/migrations_pgsql_db/m200000_000001_create_table_editcolumns.php
+1-1
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ public function safeUp()
17
17
3 => '"str_col_def" varchar NOT NULL',
18
18
4 => '"json_col" text NOT NULL DEFAULT \'fox jumps over dog\'',
19
19
5 => '"json_col_2" jsonb NOT NULL DEFAULT \'[]\'',
0 commit comments