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

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

Open
bleucitron opened this issue Sep 18, 2015 · 3 comments
Open

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

bleucitron opened this issue Sep 18, 2015 · 3 comments

Comments

@bleucitron
Copy link
Contributor

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);
                            });
                        }
                    })
@vallettea
Copy link
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

@DavidBruant
Copy link
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).

@vallettea
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants