yiisoft / db

Yii Database Library
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
130 stars 35 forks source link

New columns for v2 #808

Open Tigrov opened 4 months ago

Tigrov commented 4 months ago

This is a draft to see new concept of columns for version 2.0

Main changes:

  1. Removed ColumnSchema::$name and ColumnSchema::$precision (use ColumnSchema::$size)
  2. Renames ColumnSchema::$enumValues to ColumnSchema::$values (related with some issues)
  3. Added ColumnSchema::getFullDbType() method to get full name of the type, e.g. varchar(20)
  4. Removed pk abstract type constants ColumnSchemaInterface::...pk use ColumnBuilder::...pk() instead
  5. AbstractColumn and ColumnInterface marked as deprecated till version 3.0.0
  6. AbstractColumnSchema renamed to Column
  7. Realized TypeColumn classes (IntegerColumn, StringColumn, etc)
  8. Realized ColumnFactory, ColumnBuilder and ColumnDefinitionBuilder
  9. Added constructor to TableSchema (instead of AbstractSchema::resolveTableName())

The changes will solve few issues and after related improvements it will solve few more issues. It will allow specify any php type or object type for any db type or table column.

Q A
Is bugfix? ✔️
New feature? ✔️
Breaks BC? ✔️
Fixed issues several
what-the-diff[bot] commented 4 months ago

PR Summary

All these changes collectively aim to expand capabilities of database operations, making the system much more versatile. From running queries in a more effective way to handling a wide variety of column types, these updates bring greater flexibility and utility to the table.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 68.20513% with 186 lines in your changes are missing coverage. Please review.

Project coverage is 80.92%. Comparing base (e380ae2) to head (5510e4f). Report is 1 commits behind head on master.

Files Patch % Lines
src/Schema/Column/ColumnBuilder.php 14.73% 81 Missing :warning:
src/Schema/Column/BigIntColumn.php 0.00% 20 Missing :warning:
src/Schema/Column/Column.php 84.25% 20 Missing :warning:
src/Schema/Column/ColumnFactory.php 82.45% 20 Missing :warning:
src/Schema/Column/BitColumn.php 0.00% 19 Missing :warning:
src/QueryBuilder/ColumnDefinitionBuilder.php 88.59% 13 Missing :warning:
src/Schema/Column/JsonColumn.php 54.54% 5 Missing :warning:
src/Schema/Column/BooleanColumn.php 84.61% 2 Missing :warning:
src/Schema/Column/DoubleColumn.php 84.61% 2 Missing :warning:
src/Schema/Column/IntegerColumn.php 84.61% 2 Missing :warning:
... and 2 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #808 +/- ## ============================================= - Coverage 99.56% 80.92% -18.64% - Complexity 1316 1466 +150 ============================================= Files 64 75 +11 Lines 3236 3686 +450 ============================================= - Hits 3222 2983 -239 - Misses 14 703 +689 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.