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

Support for Multiple Databases - Breaking Change Since v1.3.36 #44

Closed
Irrelon opened this issue May 21, 2015 · 9 comments
Closed

Support for Multiple Databases - Breaking Change Since v1.3.36 #44

Irrelon opened this issue May 21, 2015 · 9 comments

Comments

@Irrelon
Copy link
Owner

Irrelon commented May 21, 2015

In order to support multiple named databases Forerunner's instantiation has changed slightly. In previous versions you only had access to a single database that you instantiated via:

var db = new ForerunnerDB();

Now you have access to multiple databases via from the main forerunner instance but this requires that you change your instantiation code to:

var fdb = new ForerunnerDB();
var db = fdb.db('myDatabaseName');

Multiple database support is a key requirement that unfortunately requires we change the instantiation pattern as detailed above. Although this is a fundamental change to the way ForerunnerDB is instantiated we believe the impact to your projects will be minimal as it should only require you to update at most 2 lines of your project's code in order to "get it working" again.

@Irrelon
Copy link
Owner Author

Irrelon commented May 21, 2015

Persistence Module and Multiple Databases

Please also note that while we have updated the instantiation to support multiple databases (to ensure that future projects are using the correct instantiation pattern), multiple database support is still a work in progress. This means that the persistence module still expects to be operating under a single database and will not save / load data based on the database name so persistence will load the same data for every database regardless of the DB name.

An update to the persistence module is coming to ensure multiple databases are supported. Other functionality should not be affected by the change to multiple DB support and should operate as expected. If you find any area of ForerunnerDB that is affected but not mentioned here, please reply to this issue and let us know so we can fix it ASAP!

Thanks!

@YurySolovyov
Copy link

Maybe if there is only 1 database, load if by default?

@Irrelon
Copy link
Owner Author

Irrelon commented May 22, 2015

@YuriSolovyov Multi-DB support in persistence module is pretty easy really. It's just a minor update around how the data is saved and loaded. With the addition of eager save / load mode (your issue #41) databases will also load their persistent data on first access.

@YurySolovyov
Copy link

I was just thinking of how you can have some kind of backward compatibility here.

@Irrelon
Copy link
Owner Author

Irrelon commented May 22, 2015

@YuriSolovyov Ahh I see. Yes I think the plan will be to detect any previously "unasigned" data and load it in to the first DB that gets requested, then on save it will be in the new multi-db format.

Technically since all ForerunnerDB projects have been single-db only up until this point it should be save to assume the saved data is for the first database being requested.

@Irrelon
Copy link
Owner Author

Irrelon commented Jun 23, 2015

Persist module multi-db support now available in version 1.3.52

@Irrelon
Copy link
Owner Author

Irrelon commented Jul 21, 2015

Since this is now quite a few versions ago, this announcement is now being closed.

@Irrelon Irrelon closed this as completed Jul 21, 2015
@ghost
Copy link

ghost commented Jan 7, 2016

Hmm... but the examples on the main page still use the old init procedure??
http://www.forerunnerdb.com/demo.html

@Irrelon
Copy link
Owner Author

Irrelon commented Jan 7, 2016

@mojovski Corrected :)

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

No branches or pull requests

2 participants