From d4a8801cd20832d5be140ff738044459f81cc8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Mon, 8 Dec 2025 22:29:07 +0100 Subject: [PATCH] preparations for object class changes --- include/matador/object/constraint.hpp | 2 ++ source/core/object/object_generator.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/matador/object/constraint.hpp b/include/matador/object/constraint.hpp index 70b19b1..71be9a7 100644 --- a/include/matador/object/constraint.hpp +++ b/include/matador/object/constraint.hpp @@ -3,6 +3,7 @@ #include "matador/utils/constraints.hpp" +#include #include #include #include @@ -57,6 +58,7 @@ public: private: std::string constraint_name; utils::constraints options_{utils::constraints::None}; + std::shared_ptr reference_; std::string column_name; std::string ref_table_name; std::string ref_column_name; diff --git a/source/core/object/object_generator.cpp b/source/core/object/object_generator.cpp index 8b4d0cc..b97e929 100644 --- a/source/core/object/object_generator.cpp +++ b/source/core/object/object_generator.cpp @@ -26,9 +26,13 @@ void object_generator::create_pk_constraint(const std::string& name) const { void object_generator::create_fk_constraint(const std::type_index& ti, const std::string& name) const { const auto result = repo_.basic_info(ti); if (!result) { + repo_.provide_object_in_advance(ti, std::make_shared("")); + repo_.has_object_for_type(ti); + repo_.object_for_type(ti); + repo_.remove_object_for_type(ti); return; } - const auto *pk_attribute = result.value().get().primary_key_attribute(); + const auto *pk_attribute = result->get().primary_key_attribute(); class constraint pk_constraint("FK_" + object_->name() + "_" + name); pk_constraint.options_ |= utils::constraints::ForeignKey; if (const auto pk_attr = find_attribute_by_name(name); pk_attr != std::end(object_->attributes_)) {