Skip to content

Verify that init-db actually loads backups when present #32

Description

@bleucitron

Currently, the code looks exactly the same:

                    .then(function(){   
                        if (!process.env.BACKUP) {
                            console.log('no backup file');
                            generateDefinitions()
                            .then(function(){
                                console.log("Dropped and created the tables.");
                                resolve();
                            })
                            .catch(function(err){
                                console.error("Couldn't write the schema", err);
                            });
                        }
                        else {
                            generateDefinitions()
                            .then(function(){
                                console.log('definitions generated');
                                resolve();
                            })
                            .catch(function(err){
                                console.error("Couldn't write the schema", err);
                            });
                        }
                    })

Activity

  1. vallettea commented on Sep 20, 2015

    @vallettea
    Contributor

    at this level yes because there used to be a call to hardCodeSensors when no backup was specified.
    The use of the db file is in createTables.js

  2. DavidBruant commented on Sep 20, 2015

    @DavidBruant
    Contributor

    The use of the db file is in createTables.js

    Ouch. Not a good idea. createTables should just create the tables. Other functions should be created to deal with backups (and maybe other tools to combine them both).

  3. vallettea commented on Sep 20, 2015

    @vallettea
    Contributor

    I agree, but sometimes you write code that works and does the job and move on, leaving the code where it was written and tested...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions