diff --git a/include/sqlgen/dynamic/Type.hpp b/include/sqlgen/dynamic/Type.hpp index 3369eff..b105b1b 100644 --- a/include/sqlgen/dynamic/Type.hpp +++ b/include/sqlgen/dynamic/Type.hpp @@ -13,7 +13,7 @@ using Type = types::Float64, types::Int8, types::Int16, types::Int32, types::Int64, types::UInt8, types::UInt16, types::UInt32, types::UInt64, types::Text, types::Date, types::Timestamp, - types::TimestampWithTZ, types::VarChar>; + types::TimestampWithTZ, types::VarChar, types::Dynamic>; } // namespace sqlgen::dynamic diff --git a/include/sqlgen/dynamic/types.hpp b/include/sqlgen/dynamic/types.hpp index 500faef..5bb9bbe 100644 --- a/include/sqlgen/dynamic/types.hpp +++ b/include/sqlgen/dynamic/types.hpp @@ -93,6 +93,11 @@ struct VarChar { Properties properties; }; +struct Dynamic { + std::string type_name; + Properties properties; +}; + } // namespace sqlgen::dynamic::types #endif diff --git a/src/sqlgen/mysql/to_sql.cpp b/src/sqlgen/mysql/to_sql.cpp index bbaa119..2fe26ed 100644 --- a/src/sqlgen/mysql/to_sql.cpp +++ b/src/sqlgen/mysql/to_sql.cpp @@ -865,6 +865,8 @@ std::string type_to_sql(const dynamic::Type& _type) noexcept { } else if constexpr (std::is_same_v || std::is_same_v) { return "DATETIME"; + } else if constexpr (std::is_same_v) { + return _t.type_name; } else if constexpr (std::is_same_v) { return "TEXT"; diff --git a/src/sqlgen/postgres/to_sql.cpp b/src/sqlgen/postgres/to_sql.cpp index 43aabbc..2848935 100644 --- a/src/sqlgen/postgres/to_sql.cpp +++ b/src/sqlgen/postgres/to_sql.cpp @@ -751,9 +751,11 @@ std::string type_to_sql(const dynamic::Type& _type) noexcept { } else if constexpr (std::is_same_v) { return "TIMESTAMP WITH TIME ZONE"; + } else if constexpr (std::is_same_v) { + return _t.type_name; + } else if constexpr (std::is_same_v) { return "TEXT"; - } else { static_assert(rfl::always_false_v, "Not all cases were covered."); } diff --git a/src/sqlgen/sqlite/to_sql.cpp b/src/sqlgen/sqlite/to_sql.cpp index 747c284..c77cf8b 100644 --- a/src/sqlgen/sqlite/to_sql.cpp +++ b/src/sqlgen/sqlite/to_sql.cpp @@ -740,6 +740,8 @@ std::string type_to_sql(const dynamic::Type& _type) noexcept { std::is_same_v || std::is_same_v) { return "TEXT"; + } else if constexpr (std::is_same_v) { + return _t.type_name; } else { static_assert(rfl::always_false_v, "Not all cases were covered."); }