-
Notifications
You must be signed in to change notification settings - Fork 445
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
Introduce replacement schema management toolset (replacing ADODB XMLSchema) #2493
Comments
On tools: #2163 has introduced Laravel's query builder. That framework also has a Migrations toolset (https://laravel.com/docs/5.4/migrations). Looking at comparables, there's also the standalone Phinx migration toolset; there's some discussion of the complications of using Laravel migrations outside of the Laravel framework, and using Phinx instead, that's directly relevant to our needs: https://www.reddit.com/r/PHP/comments/4g9g3n/using_illuminatedatabase_outside_of_laravel/ |
On migrations: The most difficult aspect of this is probably going to be flipping the upgrade process to something that doesn't require ADODB. Suggestion: we start coding using migrations tools, invoked from the upgrade script using |
@bozana, I'd love your input on this! Just brainstorming at the moment. |
Another contender, which (at a glance) has ADODB-like table definitions in XML: http://propelorm.org/ (plus some relevant Propel/Phinx discussion from a while ago) |
I will do some research and thinking... :-) |
Hi, We are in the process of migrating from MySQL to PostgreSQL. I was just testing if DB upgrades are working on PostgreSQL when I ran into issue #1793. This issue suggests patching the ADODB library which isn't ideal. So, that got me thinking. I was wondering: have you looked into Doctrine/DBAL? https://www.doctrine-project.org/projects/dbal.html Both Propel (http://propelorm.org/) and Laravel's Eloquent (https://laravel.com/docs/5.8/eloquent) (which offers a migration toolkit) are fully fledged ORM libraries. The Doctrine Project offers it's own ORM alternative aptly named "ORM" (https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/index.html) Looking at OJS, my assessment would be that moving towards a fully fledged ORM would certainly bring many benefits and simplifications, but it's definitely a big challenge as it would require major architectural changes. DBAL might be an intermediate solution. It would allow OJS to isolate database related logic and provide a nicely abstracted API that can be used, without necessarily being shoe-horned into OOP models that represent and track database state. Further making the case for DBAL: Schema manager:
Platforms:
Transactions
Query builder
Here's an example application I wrote that leverages DBAL for managing a MySQL to MS SQL migration: https://github.com/VlaamseKunstcollectie/tmssync So, a potential approach might look like this: Taking a stab at the OJS code, I'd reckon that Basically, you would keep the function signatures in those classes intact, but you'd replace references to ADODB with DBAL. That way, you'd avoid touching the rest of the codebase at this point. Testing whether it works would be by yanking out the entire ADODB library and all related "require" or "import" statements and see how much breaks. Finally, you want to gradually strip out OJS code that's doing what DBAL already offers out of the box such as creating prepared statements, sanitising SQL queries, etc. Regardless, I'm aware that replacing ADODB is a fundamental change to implement. So, it's not something I expect to land anytime soon. |
@netsensei, thanks, that's a very thoughtful summary of a bunch of good options. I'm not sure if you've encountered OJS's service classes yet (e.g. https://github.com/pkp/pkp-lib/blob/master/classes/services/PKPSubmissionService.inc.php), and their associated query builder classes (https://github.com/pkp/pkp-lib/blob/master/classes/services/queryBuilders/PKPSubmissionQueryBuilder.inc.php) -- these are new tools that are gradually displacing what used to be coded in the DAOs. Our goal is to gradually move queries over to the querybuilder pattern, then shift the additional elements like schema management and upgrade processes over to a migrations-based toolset. And then we can get rid of ADODB. This will be quite a long process, but aspects of it are already well underway! |
Okay! That's great news! I haven't seen those service classes yet. Looks like you're currently leveraging Consolidating your database interfacing logic into service classes is definitely a big step forward. I also notice there's work being done moving towards a PSR-4 compliant DI service container support to manage dependencies which is another good thing. Keeping tabs on this! |
This reverts commit 08992ea.
…econciled 3.0.x/3.2.x upgrade expectations
Introduce replacement toolset for ADODB.
PLUGIN_UPGRADE_FILE
.] [Also apparently never worked.]The text was updated successfully, but these errors were encountered: