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

SQL data store #150

Open
hanneskod opened this issue Jan 18, 2018 · 3 comments
Open

SQL data store #150

hanneskod opened this issue Jan 18, 2018 · 3 comments

Comments

@hanneskod
Copy link
Member

The json thing is good during development. As it is easy to inspect. But someting faster is needed in the future. Should probably be a choice between SQLite and MySQL..

@hanneskod hanneskod removed the alpha 3 label Apr 16, 2018
@hanneskod

This comment has been minimized.

@hanneskod
Copy link
Member Author

hanneskod commented Jan 30, 2019

As of beta-5 we have giroapp.ini settings anticipating db adapters and pdo support:

; Database driver to use, currently only 'json' is supported
db_driver = json

; Data Source Name, the information required to connect to the database
; Values are driver specific
db_dsn = "%base_dir%/data"

@hanneskod
Copy link
Member Author

There is now a set of interfaces defining the database layer. Implement these interfaces to add new database drivers. See the Db namespace. Also see the Json driver for an example.

Implementation agnostic tests are in DonorRepositorySpecTrait and ImportHistorySpecTrait. (See the json testsuite for reference.)

Also note that database drivers can be written as plugins using something like

use byrokrat\giroapp\Plugin\PluginInterface;
use byrokrat\giroapp\Plugin\EnvironmentInterface;

return new class implements PluginInterface {
    public function loadPlugin(EnvironmentInterface $env): void
    {
        $env->registerDatabaseDriver(new MyCustomDatabaseDriverFactory);
    }
};

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

1 participant