-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathDistTableData.php
More file actions
34 lines (25 loc) · 1.03 KB
/
Copy pathDistTableData.php
File metadata and controls
34 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php namespace DBDiff\DB\Data;
use DBDiff\Params\ParamsFactory;
use DBDiff\Params\TableFilter;
use DBDiff\Diff\InsertData;
use DBDiff\Diff\UpdateData;
use DBDiff\Diff\DeleteData;
use DBDiff\Exceptions\DataException;
use DBDiff\Logger;
class DistTableData {
function __construct($manager) {
$this->manager = $manager;
$this->source = $this->manager->getDB('source');
$this->target = $this->manager->getDB('target');
}
public function getDiff($table, $key) {
Logger::info("Now calculating data diff for table `$table` (cross-server)");
$params = ParamsFactory::get();
$driver = $this->manager->getDriver();
$columns1 = $this->manager->getColumns('source', $table);
$columns2 = $this->manager->getColumns('target', $table);
$fieldsToIgnore = TableFilter::getFieldsToIgnore($table, $params);
$merge = new StreamingMergeDiff($this->source, $this->target, $driver);
return $merge->getDiff($table, $key, $columns1, $columns2, $fieldsToIgnore);
}
}