From 79b854d23c05d155b587d4610c4e5c5edb2731b9 Mon Sep 17 00:00:00 2001 From: Jacyking <791026912@qq.com> Date: Tue, 19 Dec 2023 15:56:17 +0800 Subject: [PATCH 1/5] pg auto key lack of type --- include/postgresql.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/postgresql.hpp b/include/postgresql.hpp index 2e25513d..07f2a0b9 100644 --- a/include/postgresql.hpp +++ b/include/postgresql.hpp @@ -333,7 +333,7 @@ class postgresql { } else if constexpr (std::is_same_v) { if (!has_add_field) { - append(sql, field_name.data(), " "); + append(sql, field_name.data(), " ", type_name_arr[i]); } append(sql, " serial primary key"); has_add_field = true; From 62be3a23f03ea3b24cbadc5b4361b5c3923dd81d Mon Sep 17 00:00:00 2001 From: Jacyking <791026912@qq.com> Date: Tue, 19 Dec 2023 16:01:31 +0800 Subject: [PATCH 2/5] cancel pg auto key lack of type --- include/postgresql.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/postgresql.hpp b/include/postgresql.hpp index 07f2a0b9..2e25513d 100644 --- a/include/postgresql.hpp +++ b/include/postgresql.hpp @@ -333,7 +333,7 @@ class postgresql { } else if constexpr (std::is_same_v) { if (!has_add_field) { - append(sql, field_name.data(), " ", type_name_arr[i]); + append(sql, field_name.data(), " "); } append(sql, " serial primary key"); has_add_field = true; From 94c399a8f90b53f886cbf6427e1a8cf08f304384 Mon Sep 17 00:00:00 2001 From: Jacyking <791026912@qq.com> Date: Tue, 19 Dec 2023 17:19:07 +0800 Subject: [PATCH 3/5] pg auto key use "bigserial" when the type is int64_t --- include/postgresql.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/postgresql.hpp b/include/postgresql.hpp index 2e25513d..832f01d1 100644 --- a/include/postgresql.hpp +++ b/include/postgresql.hpp @@ -333,9 +333,14 @@ class postgresql { } else if constexpr (std::is_same_v) { if (!has_add_field) { - append(sql, field_name.data(), " "); + if (type_name_arr[i] == "bigint") { + append(sql, field_name.data(), " ", "bigserial"); + } + else { + append(sql, field_name.data(), " ", "serial"); + } } - append(sql, " serial primary key"); + append(sql, " primary key"); has_add_field = true; } else if constexpr (std::is_same_v) { From c030d0900a87c53a81982fbc1052ac211d63b63e Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:31:12 +0800 Subject: [PATCH 4/5] Update code-coverage.yml --- .github/workflows/code-coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 106fa2a4..221ab7da 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -32,7 +32,7 @@ jobs: working-directory: ${{github.workspace}}/build env: CTEST_OUTPUT_ON_FAILURE: 1 - run: ctest -C ${{ matrix.configuration }} -j `nproc` -V + run: ctest -C Debug -j `nproc` -V - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 \ No newline at end of file + uses: codecov/codecov-action@v1 From 1f212bc405f79d4c4eb072b160e4b8cb63b597c0 Mon Sep 17 00:00:00 2001 From: Jacyking <791026912@qq.com> Date: Fri, 22 Dec 2023 12:36:48 +0800 Subject: [PATCH 5/5] Update code-coverage.yml --- .github/workflows/code-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 221ab7da..8ad7f0ec 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -35,4 +35,4 @@ jobs: run: ctest -C Debug -j `nproc` -V - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v1 \ No newline at end of file