Skip to content

Commit

Permalink
pg auto key use "bigserial" when the type is int64_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Dec 19, 2023
1 parent 62be3a2 commit 94c399a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/postgresql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,14 @@ class postgresql {
}
else if constexpr (std::is_same_v<decltype(item), ormpp_auto_key>) {
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<decltype(item), ormpp_unique>) {
Expand Down

0 comments on commit 94c399a

Please sign in to comment.