[odb-users] Schema change for std::set<QString> 2.4.0 vs 2.5.0

Richard Oehlinger richard.oehlinger at adbsafegate.com
Wed Apr 30 08:35:44 EDT 2025


Hello!
We are in the process of upgrading from ODB 2.4.0 to 2.5.0 and found that the same C++ code produces different schema on those versions:

=========================

struct MyClass
{
    QString           m_id{};
    std::set<QString> string_set;
};
PRAGMA_DB(object(MyClass))
PRAGMA_DB(member(MyClass::m_id) id)

=========================

# ODB 2.4.0
CREATE TABLE "MyClass" (
  "id" TEXT NOT NULL PRIMARY KEY);

CREATE TABLE "MyClass_string_set" (
  "object_id" TEXT NOT NULL,
  "value" TEXT NOT NULL,                             ;<== DIFF
  CONSTRAINT "object_id_fk"
    FOREIGN KEY ("object_id")
    REFERENCES "MyClass" ("id")
    ON DELETE CASCADE);

==========================

# ODB 2.5.0
CREATE TABLE "MyClass" (
  "id" TEXT NOT NULL PRIMARY KEY);

CREATE TABLE "MyClass_string_set" (
  "object_id" TEXT NOT NULL,
  "value" TEXT NULL,                                 ;<== DIFF
  CONSTRAINT "object_id_fk"
    FOREIGN KEY ("object_id")
    REFERENCES "MyClass" ("id")
    ON DELETE CASCADE);

==========================

Was this change on purpose? Can I do anything to prevent a schema change or should I just bite the bullet and introduce a new schema version.

BR Richard



More information about the odb-users mailing list