Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

add transcoding between DB and DSQL + Test #8

Closed
wants to merge 8 commits into from

Conversation

abbadon1334
Copy link
Collaborator

i dunno if this is the direction of this library, but i add some transcode to normalize different PDO drivers and DSQL, i add some tests to check every type, i tested it on sqlite and mysql.

* add transcode table for field type => datatype database
* tested on SQLite and MySQL
more space is better than less, this class is very useful during development,
after that will be disabled and database must be optimized with other tools.

i changed because i had a problem storing serialized EXIF in array datatype
Copy link
Member

@DarkSide666 DarkSide666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting and looks like very good PR. I like this idea of using proxy transcoding.
But please:

  • replace Tab to 4 spaces and Windows line ends \r\n to Linux line ends - just \n
  • variable names - we use first lowercase letter most of the time etc.
  • code formatting is important for code to look nice and easily readable
  • and please try to address at least part of my comments

When that will be done, then I will review one more time more closely and including tests.

But really - good job, thanks!

'integer' => 'INT4',
'string' => 'VARCHAR256',
'password' => 'VARCHAR256',
'double' => 'DOUBLE',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no double type in Agile Data

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know, but in case we need to store more precision ?

'time' => 'TIME',
'text' => 'TEXT',
'array' => 'TEXT',
'object' => 'BLOB',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's serialized as json or base64 - all of them are TEXT not BLOB by nature, so i think using TEXT is better here.

@@ -77,7 +296,7 @@ public function setModel(\atk4\data\Model $m)
{
$this->table($m->table);

foreach ($m->elements as $field) {
foreach ($m->elements as $field) {
Copy link
Member

@DarkSide666 DarkSide666 Feb 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting uses Tabs. Please use 4 spaces instead of tabs everywhere

/**
* Get Transcode Type Key from Model type
*
* @param field $field DSQL field
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect param type

return $type;
}
/**
* Get Transcode Type Key from Model type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect description

switch to codeformatting PSR-1,PSR-2
add hasOne in Test
@abbadon1334 abbadon1334 mentioned this pull request Feb 16, 2019
@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #8 into develop will decrease coverage by 6.34%.
The diff coverage is 51.02%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop       #8      +/-   ##
=============================================
- Coverage      72.33%   65.98%   -6.35%     
- Complexity       129      146      +17     
=============================================
  Files              5        5              
  Lines            300      344      +44     
=============================================
+ Hits             217      227      +10     
- Misses            83      117      +34
Impacted Files Coverage Δ Complexity Δ
src/Migration/SQLite.php 100% <ø> (ø) 1 <0> (ø) ⬇️
src/MigratorConsole.php 0% <0%> (ø) 4 <1> (+1) ⬆️
src/Migration/MySQL.php 90.9% <100%> (ø) 3 <0> (ø) ⬇️
src/Migration.php 65.5% <56.09%> (-7.8%) 99 <14> (+16)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b856ea0...3984000. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants