Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"dbcopy.php create -c <config>" won't create sqlite db #188

Closed
justinotherguy opened this issue Nov 24, 2014 · 2 comments
Closed

"dbcopy.php create -c <config>" won't create sqlite db #188

justinotherguy opened this issue Nov 24, 2014 · 2 comments
Labels

Comments

@justinotherguy
Copy link
Member

Here's what I did:

  • git clone https://github.com/andig/dbcopy.git
  • dbcopy.json angepasst:
    "source": {
    // source database connection
    "driver": "pdo_mysql",
    "host": "localhost",
    "user": „vz",
    "password": „<sssh!>",
    "dbname": "volkszaehler"
    },
    "target": {
    // target database connection
    "driver": "pdo_sqlite",
    "path": "sqlite.db3", // path is only used if driver = pdo_sqlite
    "host": "localhost",
    "user": "travis",
    "password": ""
    // "dbname": „backup“
    […] remainder: default
  • installed composer ("curl -s http://getcomposer.org/installer | php“, "php composer.phar install")
  • installed sqlite driver: apt-get install sqlite libsqlite0 php5-sqlite
  • generate target db:
    php /opt/dbcopy/dbcopy.php create -c /opt/dbcopy/dbcopy.json
    Creating target schema
    renaming assets for target platform: sqlite
    table: data
    table: entities
    table: entities_in_aggregator
    table: properties
    -> doesn't seem to create a sqlite db
    s. https://demo.volkszaehler.org/pipermail/volkszaehler-users/2014-November/004887.html
@andig andig added the Bug label Nov 30, 2014
@andig
Copy link
Contributor

andig commented Dec 8, 2014

I've pushed an update andig/dbcopy@b850d5b. Run composer update to fetch these changes.

To perform a backup to sqlite follow there steps:

  1. create local.json

    {
        "source": {
            "driver": "pdo_mysql",
            "host": "localhost",
            "user": "travis",
            "password": "",
            "dbname": "volkszaehler"
        },
        "target": {
            "driver": "pdo_sqlite",
            "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"
            }
        ]
    }
    
  2. create the sqlite schema

    php dbcopy.php create -c local.json
    
  3. run the backup

    php dbcopy.php backup -c local.json
    

@andig
Copy link
Contributor

andig commented Dec 12, 2014

Just did a clean install as my pc died. WFM.

@andig andig closed this as completed Dec 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants