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

test: add test for Postgre upsertBatch() #8453

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jan 25, 2024

Description

  • add test
        $data = [
            // new row insert
            [
                'type_varchar'  => 'insert', // Key
                'type_bigint'   => 9_999_999,
                'type_date'     => '2024-01-01',
                'type_datetime' => '2024-01-01 09:00:00',
            ],
            // update
            [
                'type_varchar'  => 'test1', // Key
                'type_bigint'   => 9_999_999,
                'type_date'     => '2024-01-01',
                'type_datetime' => '2024-01-01 09:00:00',
            ],
        ];

        $builder->onConstraint('type_varchar')->upsertBatch($data);
INSERT INTO "db_type_test" ("type_bigint", "type_date", "type_datetime", "type_varchar")
VALUES (9999999,'2024-01-01','2024-01-01 09:00:00','insert'), (9999999,'2024-01-01','2024-01-01 09:00:00','test1')
ON CONFLICT("type_varchar")
DO UPDATE SET
"type_bigint" = "excluded"."type_bigint",
"type_date" = "excluded"."type_date",
"type_datetime" = "excluded"."type_datetime"

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the testing Pull requests that changes tests only label Jan 25, 2024
Copy link
Member

@sclubricants sclubricants left a comment

Choose a reason for hiding this comment

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

Looks good

@kenjis kenjis merged commit 2190110 into codeigniter4:develop Jan 25, 2024
59 checks passed
@kenjis kenjis deleted the test-postgre-upsertBatch branch January 25, 2024 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Pull requests that changes tests only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants