Skip to content

Commit

Permalink
Added misc/tools/dbcopy.php as external dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Oct 5, 2014
1 parent 65777a2 commit d9aebad
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 32 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"require": {
"doctrine/orm": "2.4.*",
"jpgraph/jpgraph": "dev-master",
"symfony/console": "2.5.*"
"andig/dbcopy": "dev-master",
"symfony/console": "2.6.*@dev"
},
"require-dev": {
"phpunit/phpunit": "4.1.*"
Expand All @@ -21,5 +22,8 @@
"Tests\\": "test/",
"Wrapper\\": "test/"
}
},
"scripts": {
"post-install-cmd": "php -r \"@copy('vendor/andig/dbcopy/dbcopy.php', 'misc/tools/dbcopy.php');\""
}
}
87 changes: 59 additions & 28 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Volkszaehler/Model/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @Table(
* name="aggregate",
* indexes={@index(name="search_idx", columns={"channel_id", "type", "timestamp"})},
* uniqueConstraints={@UniqueConstraint(name="ts_uniq", columns={"channel_id", "type", "timestamp"})}
* uniqueConstraints={@UniqueConstraint(name="aggregate_unique", columns={"channel_id", "type", "timestamp"})}
* )
*/
class Aggregate {
Expand Down
2 changes: 1 addition & 1 deletion lib/Volkszaehler/Model/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @Table(
* name="data",
* indexes={@index(name="search_idx", columns={"channel_id", "timestamp"})},
* uniqueConstraints={@UniqueConstraint(name="ts_uniq", columns={"channel_id", "timestamp"})}
* uniqueConstraints={@UniqueConstraint(name="data_unique", columns={"channel_id", "timestamp"})}
* )
*/
class Data {
Expand Down
2 changes: 1 addition & 1 deletion lib/Volkszaehler/Model/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @Table(
* name="properties",
* uniqueConstraints={
* @UniqueConstraint(name="unique_keys", columns={"entity_id", "pkey"})
* @UniqueConstraint(name="property_unique", columns={"entity_id", "pkey"})
* }
* )
* @HasLifecycleCallbacks
Expand Down
46 changes: 46 additions & 0 deletions misc/tools/dbcopy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"source": {
"driver": "pdo_mysql",
"host": "localhost",
"user": "travis",
"password": "",
"dbname": "volkszaehler"
},
"target": {
"driver": "pdo_mysql",
"host": "localhost",
"user": "travis",
"password": "",
"dbname": "volkszaehler_backup",
"path": "sqlite.db3" // path is only used if driver = pdo_sqlite
},
"tables": [
// TABLE DEFINITION
// ----------------
// table name
// tables will be processed in the order they are mentioned:
// - foreign keys on target will be dropped
// - if a table is not listed here, it will not be touched
// transfer mode
// skip: table will not be copied
// copy: entire table will be truncated on target and copied from source
// pk: selective copy by primary key. only data not present on target
// will be copied from source.
{
"name": "entities",
"mode": "copy"
}, {
"name": "properties",
"mode": "copy"
}, {
"name": "entities_in_aggregator",
"mode": "copy"
}, {
"name": "data",
"mode": "pk"
}, {
"name": "aggregate",
"mode": "skip"
}
]
}

0 comments on commit d9aebad

Please sign in to comment.