db icon indicating copy to clipboard operation
db copied to clipboard

New columns for v2

Open Tigrov opened this issue 4 months ago • 1 comments

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

Tigrov avatar Feb 07 '24 07:02 Tigrov

PR Summary

  • AbstractPdoConnection.php Changes

    • The connection class has been updated to use a new library for database operation. This change improves connectivity with the database.
  • AbstractDDLQueryBuilder.php Updates

    • A method for adding dimensions was introduced to this class in order to make it more flexible. The function can handle additional types of input.
  • AbstractDMLQueryBuilder.php Modifications

    • Altered a method that handles data typing to make it more versatile. As a result, data input and output operations should become more efficient.
  • AbstractQueryBuilder.php Changes

    • Enhanced the building of queries by adding better data pattern detection. This provides more reliable data manipulation and extraction.
  • New Files - ColumnDefinitionBuilder & ColumnDefinitionBuilderInterface

    • These new files were added for the sake of managing column definitions. They make it easier to specify what each column in a database table should be like.
  • DDLQueryBuilderInterface.php Updates

    • The addColumn method was expanded to support a wider variety of input, improving our usage of the method as it now can accept more types of inputs.
  • QueryBuilderInterface.php Adjustments

    • We improved the ability to build column definitions via an added method. This allows column definitions to be formulated more easily.
  • Removal of AbstractColumnSchema.php

    • An old file was removed due to obsolescence.
  • Changes to AbstractTableSchema.php & AbstractSchema.php

    • The construction and column handling methods of table schema classes were significantly adjusted, leading to improved flexibility and greater clarity in code usage.
  • Additions of New Column Files

    • A variety of new column classes (like BigIntColumn, BinaryColumn, etc.) were introduced for better handling of database attributes.
  • Additions of New Schema Column Files

    • Several files were added for a more robust column creation process. They contain classes and interfaces for creating column schemas based on database column types.
  • Changes to Column, ColumnBuilder, ColumnFactory Files

    • These files were updated with methods for creating and managing columns based on database or abstract types.
  • Renaming and Moving of ColumnSchemaInterface

    • The interface was renamed and relocated to better align with its purpose. Several new features were also added to expand its functionality.
  • Addition of New Column Classes

    • Several new column classes were added, each handling specific data types, which extends our ability to handle varied types of database attributes better.
  • Adjustment to SchemaInterface

    • New methods were added allowing for creation and defining values for various column types.
  • Modification to TableSchemaInterface

    • Altered column-related methods to use the new ColumnInterface for a more optimal database operation experience.
  • Test Case Updates

    • The changes were reflected in corresponding test cases to ensure the new code works as intended, enhancing code reliability.
  • Addition and Changes to Test Files

    • New test associated files were added or updated to efficiently verify the changes in code and ensure its efficacy. It includes test methods for a range of column schemas and operations, which improves the testing process.

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.

what-the-diff[bot] avatar Feb 07 '24 07:02 what-the-diff[bot]

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
@@              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.

codecov[bot] avatar Apr 22 '24 08:04 codecov[bot]