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

feat: Allow adding another database group #34

Merged
merged 11 commits into from
Sep 21, 2022

Conversation

daycry
Copy link
Contributor

@daycry daycry commented Aug 31, 2022

  • Allow adding another database group

- Allow adding another database group
@kenjis
Copy link
Member

kenjis commented Aug 31, 2022

Thank you for sending a PR.

We have updated the guideline for git commit.
Please read https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#committing

@kenjis
Copy link
Member

kenjis commented Aug 31, 2022

You must GPG-sign your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open-source project. See Developer's Certificate of Origin.

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#signing

@daycry
Copy link
Contributor Author

daycry commented Aug 31, 2022

I tried it, but always return an error message.

@kenjis
Copy link
Member

kenjis commented Aug 31, 2022

The basic steps:
https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/signing.md#secure-signing

What did you do?
and what did you get? the exact error message?

@daycry
Copy link
Contributor Author

daycry commented Aug 31, 2022

Done. Key imported

@daycry
Copy link
Contributor Author

daycry commented Aug 31, 2022

Who Can review this changes? I think that are interesting changes.

composer.json Outdated Show resolved Hide resolved
phpunit.xml.dist Outdated Show resolved Hide resolved
@kenjis
Copy link
Member

kenjis commented Sep 1, 2022

@kenjis kenjis changed the title - Improvements Allow adding another database group Sep 1, 2022
@kenjis kenjis changed the title Allow adding another database group feat: Allow adding another database group Sep 1, 2022
@MGatner
Copy link
Member

MGatner commented Sep 1, 2022

@daycry the development kit here does need to be updated but that should happen in a separate PR. I will try to get that done today, but please remove those changes from this PR in the meantime.

I will wait to review, but generally this looks like a desirable feature!

@kenjis
Copy link
Member

kenjis commented Sep 1, 2022

@MGatner I sent #35

@kenjis
Copy link
Member

kenjis commented Sep 1, 2022

@daycry We have updated the development kit. Please rebase to resolve conflicts and remove unneeded changes in this PR.
See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#updating-your-branch

@daycry
Copy link
Contributor Author

daycry commented Sep 1, 2022

Ok, I Will do It.

Although I have seen that the changes you have made in composer and phpunit are the same as I have done, I will delete my changes and create the pull request again.

thank you!

@daycry
Copy link
Contributor Author

daycry commented Sep 1, 2022

I do the signed commit.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Some design thoughts. Also please do try some tests - there should be some there that make a decent starting point.

use CodeIgniter\Settings\Handlers\ArrayHandler;
use CodeIgniter\Settings\Handlers\DatabaseHandler;

class Settings
class Settings extends BaseConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there were recursion issues or something why Lonnie didn't originally make this an actual Config class. @lonnieezell you available to comment?

@@ -2,10 +2,22 @@

namespace CodeIgniter\Settings\Database\Migrations;

use CodeIgniter\Config\BaseConfig;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is okay to require the Config to be ours (or an extension thereof):

Suggested change
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Settings\Config\Settings;

@@ -2,10 +2,22 @@

namespace CodeIgniter\Settings\Database\Migrations;

use CodeIgniter\Config\BaseConfig;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Settings\Config\Settings;

use CodeIgniter\Database\Migration;

class CreateSettingsTable extends Migration
{
private BaseConfig $config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private BaseConfig $config;
private Settings $config;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, see below: this can be dropped altogether.

use CodeIgniter\Database\Migration;

class AddContextColumn extends Migration
{
private BaseConfig $config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private BaseConfig $config;
private Settings $config;

src/Handlers/DatabaseHandler.php Outdated Show resolved Hide resolved
@daycry
Copy link
Contributor Author

daycry commented Sep 2, 2022 via email

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling is probably a case for going with BaseConnection instead of BaseBuilder, but since these are "things really went wrong" situations it is more of a debug so I'm okay with it. Let's see what @kenjis thinks.

@MGatner MGatner requested a review from kenjis September 5, 2022 11:35
@kenjis
Copy link
Member

kenjis commented Sep 21, 2022

@MGatner What do you mean with the error handling?

@kenjis
Copy link
Member

kenjis commented Sep 21, 2022

This PR looks good. I'm merging for now.

@kenjis kenjis merged commit c648852 into codeigniter4:develop Sep 21, 2022
@kenjis kenjis added the enhancement New feature or request label Sep 21, 2022
@MGatner
Copy link
Member

MGatner commented Sep 21, 2022

@kenjis I meant the way the RuntimeExceptions still rely on BaseConnection instead of BaseBuilder. Either way it isn't proper adherence to Law of Demeter, but in this case the connection is only needed for error handling so isn't really a dependency. It's also an issue with our database classes, that errors are not accessible from the class where they occurred.

So yes: this is good, thanks for merging!

@MGatner
Copy link
Member

MGatner commented Sep 21, 2022

(In the future though we should probably be squashing PRs like this that have "train of thought" commits.)

@daycry
Copy link
Contributor Author

daycry commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants