Added flag has_primary_key_set to Model

Now we know whether the primary key is defined or not
and we do not allow to make update/remove if the key is not defined.

And when doing insert/update we can put NULL if child models don't have
the primary key set (fields with has_foreign_key set to true).

Now in after_select() we should also set has_primary_key_set flag
or just call get_last_sequence_for_primary_key instead of get_last_sequence.

fixed: added prefix +00 when serializing PT::Date to PostgreSQL (time zone)
(for a column with a time zone there was a wrong value saved)
This commit is contained in:
2021-03-09 18:10:34 +01:00
parent ff551a64b8
commit 133a45c84b
18 changed files with 474 additions and 110 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2019, Tomasz Sowa
* Copyright (c) 2019-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,7 @@ public:
void after_insert()
{
get_last_sequence(L"public.types_id_seq", id);
get_last_sequence_for_primary_key(L"public.types_id_seq", id);
}