diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-22 13:55:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-10 18:46:46 +0200 |
commit | 15c6024da6a15e2d6e3302e4df375092959edbe2 (patch) | |
tree | 713362e41b768cce1b9dd6566963a892d0a39d3c | |
parent | 31d4f4c0a03013fc8989213de5259e632fe45898 (diff) |
Add changelog test
40 files changed, 1233 insertions, 1 deletions
diff --git a/common/changelog/add-table-mssql-diff.xml b/common/changelog/add-table-mssql-diff.xml new file mode 100644 index 0000000..8d3a95d --- /dev/null +++ b/common/changelog/add-table-mssql-diff.xml @@ -0,0 +1,45 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <add-table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </add-table> + <add-table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + + <model version="1"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-mssql-patch.xml b/common/changelog/add-table-mssql-patch.xml new file mode 100644 index 0000000..204a5a9 --- /dev/null +++ b/common/changelog/add-table-mssql-patch.xml @@ -0,0 +1,42 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-mysql-diff.xml b/common/changelog/add-table-mysql-diff.xml new file mode 100644 index 0000000..019e51c --- /dev/null +++ b/common/changelog/add-table-mysql-diff.xml @@ -0,0 +1,45 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <add-table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </add-table> + <add-table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT UNSIGNED" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + + <model version="1"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-mysql-patch.xml b/common/changelog/add-table-mysql-patch.xml new file mode 100644 index 0000000..127139a --- /dev/null +++ b/common/changelog/add-table-mysql-patch.xml @@ -0,0 +1,42 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT UNSIGNED" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-oracle-diff.xml b/common/changelog/add-table-oracle-diff.xml new file mode 100644 index 0000000..e04ba2b --- /dev/null +++ b/common/changelog/add-table-oracle-diff.xml @@ -0,0 +1,45 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <add-table name="object"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <column name="o1" type="NUMBER(10)" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </add-table> + <add-table name="object_nums"> + <column name="object_id" type="NUMBER(10)" null="false"/> + <column name="index" type="NUMBER(20)" null="false"/> + <column name="value" type="NUMBER(10)" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + + <model version="1"> + <table name="object1"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-oracle-patch.xml b/common/changelog/add-table-oracle-patch.xml new file mode 100644 index 0000000..b0e32c0 --- /dev/null +++ b/common/changelog/add-table-oracle-patch.xml @@ -0,0 +1,42 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + <table name="object"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <column name="o1" type="NUMBER(10)" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="NUMBER(10)" null="false"/> + <column name="index" type="NUMBER(20)" null="false"/> + <column name="value" type="NUMBER(10)" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-pgsql-diff.xml b/common/changelog/add-table-pgsql-diff.xml new file mode 100644 index 0000000..61c4985 --- /dev/null +++ b/common/changelog/add-table-pgsql-diff.xml @@ -0,0 +1,45 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <add-table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </add-table> + <add-table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + + <model version="1"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-pgsql-patch.xml b/common/changelog/add-table-pgsql-patch.xml new file mode 100644 index 0000000..33f8850 --- /dev/null +++ b/common/changelog/add-table-pgsql-patch.xml @@ -0,0 +1,42 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-sqlite-diff.xml b/common/changelog/add-table-sqlite-diff.xml new file mode 100644 index 0000000..97b7e24 --- /dev/null +++ b/common/changelog/add-table-sqlite-diff.xml @@ -0,0 +1,45 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <add-table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </add-table> + <add-table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="INTEGER" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + + <model version="1"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table-sqlite-patch.xml b/common/changelog/add-table-sqlite-patch.xml new file mode 100644 index 0000000..84c9d75 --- /dev/null +++ b/common/changelog/add-table-sqlite-patch.xml @@ -0,0 +1,42 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="INTEGER" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + </model> +</changelog> diff --git a/common/changelog/add-table.hxx b/common/changelog/add-table.hxx new file mode 100644 index 0000000..8dfabc6 --- /dev/null +++ b/common/changelog/add-table.hxx @@ -0,0 +1,35 @@ +// file : common/changelog/add-table.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ADD_TABLE_HXX +#define ADD_TABLE_HXX + +#include <vector> + +#pragma db model version(BVER, CVER, true) + +struct object1; + +#if CVER > 1 +#pragma db object +struct object +{ + #pragma db id auto + int id; + int num; + + std::vector<int> nums; + object1* o1; +}; +#endif + +#pragma db object +struct object1 +{ + #pragma db id + int id; + int num; +}; + +#endif // ADD_TABLE_HXX diff --git a/common/changelog/drop-table-mssql-diff.xml b/common/changelog/drop-table-mssql-diff.xml new file mode 100644 index 0000000..7d6779e --- /dev/null +++ b/common/changelog/drop-table-mssql-diff.xml @@ -0,0 +1,47 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <drop-table name="object"/> + <drop-table name="object_nums"/> + </changeset> + + <model version="1"> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-mssql-patch.xml b/common/changelog/drop-table-mssql-patch.xml new file mode 100644 index 0000000..c6003ea --- /dev/null +++ b/common/changelog/drop-table-mssql-patch.xml @@ -0,0 +1,11 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-mysql-diff.xml b/common/changelog/drop-table-mysql-diff.xml new file mode 100644 index 0000000..4b223fb --- /dev/null +++ b/common/changelog/drop-table-mysql-diff.xml @@ -0,0 +1,47 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <drop-table name="object"/> + <drop-table name="object_nums"/> + </changeset> + + <model version="1"> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <column name="o1" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT UNSIGNED" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-mysql-patch.xml b/common/changelog/drop-table-mysql-patch.xml new file mode 100644 index 0000000..c6003ea --- /dev/null +++ b/common/changelog/drop-table-mysql-patch.xml @@ -0,0 +1,11 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-oracle-diff.xml b/common/changelog/drop-table-oracle-diff.xml new file mode 100644 index 0000000..9334585 --- /dev/null +++ b/common/changelog/drop-table-oracle-diff.xml @@ -0,0 +1,47 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <drop-table name="object"/> + <drop-table name="object_nums"/> + </changeset> + + <model version="1"> + <table name="object"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <column name="o1" type="NUMBER(10)" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="NUMBER(10)" null="false"/> + <column name="index" type="NUMBER(20)" null="false"/> + <column name="value" type="NUMBER(10)" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-oracle-patch.xml b/common/changelog/drop-table-oracle-patch.xml new file mode 100644 index 0000000..309aa86 --- /dev/null +++ b/common/changelog/drop-table-oracle-patch.xml @@ -0,0 +1,11 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-pgsql-diff.xml b/common/changelog/drop-table-pgsql-diff.xml new file mode 100644 index 0000000..18d01f6 --- /dev/null +++ b/common/changelog/drop-table-pgsql-diff.xml @@ -0,0 +1,47 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <drop-table name="object"/> + <drop-table name="object_nums"/> + </changeset> + + <model version="1"> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-pgsql-patch.xml b/common/changelog/drop-table-pgsql-patch.xml new file mode 100644 index 0000000..393a20f --- /dev/null +++ b/common/changelog/drop-table-pgsql-patch.xml @@ -0,0 +1,11 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-sqlite-diff.xml b/common/changelog/drop-table-sqlite-diff.xml new file mode 100644 index 0000000..5277fd8 --- /dev/null +++ b/common/changelog/drop-table-sqlite-diff.xml @@ -0,0 +1,47 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <changeset version="2"> + <drop-table name="object"/> + <drop-table name="object_nums"/> + </changeset> + + <model version="1"> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <column name="o1" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1"/> + <references table="object1"> + <column name="id"/> + </references> + </foreign-key> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="INTEGER" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table-sqlite-patch.xml b/common/changelog/drop-table-sqlite-patch.xml new file mode 100644 index 0000000..393a20f --- /dev/null +++ b/common/changelog/drop-table-sqlite-patch.xml @@ -0,0 +1,11 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="2"> + <table name="object1"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/drop-table.hxx b/common/changelog/drop-table.hxx new file mode 100644 index 0000000..a28c0d4 --- /dev/null +++ b/common/changelog/drop-table.hxx @@ -0,0 +1,35 @@ +// file : common/changelog/drop-table.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef DROP_TABLE_HXX +#define DROP_TABLE_HXX + +#include <vector> + +#pragma db model version(BVER, CVER, true) + +struct object1; + +#if CVER == 1 +#pragma db object +struct object +{ + #pragma db id auto + int id; + int num; + + std::vector<int> nums; + object1* o1; +}; +#endif + +#pragma db object +struct object1 +{ + #pragma db id + int id; + int num; +}; + +#endif // DROP_TABLE_HXX diff --git a/common/changelog/makefile b/common/changelog/makefile new file mode 100644 index 0000000..0819616 --- /dev/null +++ b/common/changelog/makefile @@ -0,0 +1,97 @@ +# file : common/changelog/makefile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make + +odb_hdr := model.hxx add-table.hxx drop-table.hxx + +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + +default := $(out_base)/ +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +# Import. +# +$(call import,\ + $(scf_root)/import/odb/stub.make,\ + odb: odb,odb-rules: odb_rules) + +# Build. +# +$(default): + +genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx)) +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(odb) FORCE # Force regeneration even if up to date. +$(gen): odb := $(odb) +$(gen) $(dist): export odb_options += --database $(db_id) \ +--generate-schema-only --schema-format sql --changelog-dir $(out_base) +$(gen): cpp_options := -I$(src_base) +$(gen): $(common.l.cpp-options) + +ifdef STEP + +ifeq ($(STEP),1) +$(gen): cpp_options += -DBVER=1 -DCVER=1 # Initialize. +else ifeq ($(STEP),2) +$(gen): cpp_options += -DBVER=1 -DCVER=2 # Diff. +else ifeq ($(STEP),3) +$(gen): cpp_options += -DBVER=2 -DCVER=3 # Patch (via rewind). +else +$(error unexpected STEP value $(STEP) +endif + +$(default): $(gen) +else +$(default): ;@: +endif + +# Dist: not supported. +# +$(dist): + +# Test. +# +$(test): tests := $(odb_hdr:.hxx=) +$(test): diff = $(call message,,diff -u $(src_base)/$1-$(db_id)-$2.xml \ +$(out_base)/$1.xml)$(literal_newline)$(literal_tab) +$(test): | $(out_base)/. + $(call message,,rm -f $(addprefix $(out_base)/,$(addsuffix .xml,$(tests)))) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=1) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=2) + $(foreach t,$(tests),$(call diff,$t,diff)) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=3) + $(foreach t,$(tests),$(call diff,$t,patch)) + +# Clean. +# +$(clean): changelogs := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.xml)) +$(clean): $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) + $(call message,,rm -f $(changelogs)) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(default) $(test): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/cxx/standard.make) # cxx_standard +ifdef cxx_standard +$(gen): odb_options += --std $(cxx_standard) +$(call include,$(odb_rules)) +endif + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/common/changelog/model-mssql-diff.xml b/common/changelog/model-mssql-diff.xml new file mode 120000 index 0000000..e1f812d --- /dev/null +++ b/common/changelog/model-mssql-diff.xml @@ -0,0 +1 @@ +model-mssql.xml
\ No newline at end of file diff --git a/common/changelog/model-mssql-patch.xml b/common/changelog/model-mssql-patch.xml new file mode 120000 index 0000000..e1f812d --- /dev/null +++ b/common/changelog/model-mssql-patch.xml @@ -0,0 +1 @@ +model-mssql.xml
\ No newline at end of file diff --git a/common/changelog/model-mssql.xml b/common/changelog/model-mssql.xml new file mode 100644 index 0000000..d9689a0 --- /dev/null +++ b/common/changelog/model-mssql.xml @@ -0,0 +1,56 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="1"> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="true" default="0" options="DUMMY=1"/> + <column name="v_x" type="INT" null="false"/> + <column name="v_y" type="INT" null="false"/> + <column name="o1_x" type="INT" null="true"/> + <column name="o1_y" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1_x"/> + <column name="o1_y"/> + <references table="object1"> + <column name="id_x"/> + <column name="id_y"/> + </references> + </foreign-key> + <index name="num_i" type="UNIQUE" method="BTREE" options="DUMMY=1"> + <column name="num" options="DESC"/> + </index> + <index name="v_i"> + <column name="v_x"/> + <column name="v_y"/> + </index> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id_x" type="INT" null="false"/> + <column name="id_y" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id_x"/> + <column name="id_y"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/model-mysql-diff.xml b/common/changelog/model-mysql-diff.xml new file mode 120000 index 0000000..9100280 --- /dev/null +++ b/common/changelog/model-mysql-diff.xml @@ -0,0 +1 @@ +model-mysql.xml
\ No newline at end of file diff --git a/common/changelog/model-mysql-patch.xml b/common/changelog/model-mysql-patch.xml new file mode 120000 index 0000000..9100280 --- /dev/null +++ b/common/changelog/model-mysql-patch.xml @@ -0,0 +1 @@ +model-mysql.xml
\ No newline at end of file diff --git a/common/changelog/model-mysql.xml b/common/changelog/model-mysql.xml new file mode 100644 index 0000000..ed46ebe --- /dev/null +++ b/common/changelog/model-mysql.xml @@ -0,0 +1,56 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="1"> + <table name="object"> + <column name="id" type="INT" null="false"/> + <column name="num" type="INT" null="true" default="0" options="DUMMY=1"/> + <column name="v_x" type="INT" null="false"/> + <column name="v_y" type="INT" null="false"/> + <column name="o1_x" type="INT" null="true"/> + <column name="o1_y" type="INT" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1_x"/> + <column name="o1_y"/> + <references table="object1"> + <column name="id_x"/> + <column name="id_y"/> + </references> + </foreign-key> + <index name="num_i" type="UNIQUE" method="BTREE" options="DUMMY=1"> + <column name="num" options="DESC"/> + </index> + <index name="v_i"> + <column name="v_x"/> + <column name="v_y"/> + </index> + </table> + <table name="object_nums"> + <column name="object_id" type="INT" null="false"/> + <column name="index" type="BIGINT UNSIGNED" null="false"/> + <column name="value" type="INT" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_id_i"> + <column name="object_id"/> + </index> + <index name="index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id_x" type="INT" null="false"/> + <column name="id_y" type="INT" null="false"/> + <column name="num" type="INT" null="false"/> + <primary-key> + <column name="id_x"/> + <column name="id_y"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/model-oracle-diff.xml b/common/changelog/model-oracle-diff.xml new file mode 120000 index 0000000..36e4479 --- /dev/null +++ b/common/changelog/model-oracle-diff.xml @@ -0,0 +1 @@ +model-oracle.xml
\ No newline at end of file diff --git a/common/changelog/model-oracle-patch.xml b/common/changelog/model-oracle-patch.xml new file mode 120000 index 0000000..36e4479 --- /dev/null +++ b/common/changelog/model-oracle-patch.xml @@ -0,0 +1 @@ +model-oracle.xml
\ No newline at end of file diff --git a/common/changelog/model-oracle.xml b/common/changelog/model-oracle.xml new file mode 100644 index 0000000..756a355 --- /dev/null +++ b/common/changelog/model-oracle.xml @@ -0,0 +1,56 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="1"> + <table name="object"> + <column name="id" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="true" default="0" options="DUMMY=1"/> + <column name="v_x" type="NUMBER(10)" null="false"/> + <column name="v_y" type="NUMBER(10)" null="false"/> + <column name="o1_x" type="NUMBER(10)" null="true"/> + <column name="o1_y" type="NUMBER(10)" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="object_o1_fk" deferred="true"> + <column name="o1_x"/> + <column name="o1_y"/> + <references table="object1"> + <column name="id_x"/> + <column name="id_y"/> + </references> + </foreign-key> + <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1"> + <column name="num" options="DESC"/> + </index> + <index name="object_v_i"> + <column name="v_x"/> + <column name="v_y"/> + </index> + </table> + <table name="object_nums"> + <column name="object_id" type="NUMBER(10)" null="false"/> + <column name="index" type="NUMBER(20)" null="false"/> + <column name="value" type="NUMBER(10)" null="false"/> + <foreign-key name="object_nums_object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id_x" type="NUMBER(10)" null="false"/> + <column name="id_y" type="NUMBER(10)" null="false"/> + <column name="num" type="NUMBER(10)" null="false"/> + <primary-key> + <column name="id_x"/> + <column name="id_y"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/model-pgsql-diff.xml b/common/changelog/model-pgsql-diff.xml new file mode 120000 index 0000000..b39ce26 --- /dev/null +++ b/common/changelog/model-pgsql-diff.xml @@ -0,0 +1 @@ +model-pgsql.xml
\ No newline at end of file diff --git a/common/changelog/model-pgsql-patch.xml b/common/changelog/model-pgsql-patch.xml new file mode 120000 index 0000000..b39ce26 --- /dev/null +++ b/common/changelog/model-pgsql-patch.xml @@ -0,0 +1 @@ +model-pgsql.xml
\ No newline at end of file diff --git a/common/changelog/model-pgsql.xml b/common/changelog/model-pgsql.xml new file mode 100644 index 0000000..6dad23b --- /dev/null +++ b/common/changelog/model-pgsql.xml @@ -0,0 +1,56 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="1"> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="true" default="0" options="DUMMY=1"/> + <column name="v_x" type="INTEGER" null="false"/> + <column name="v_y" type="INTEGER" null="false"/> + <column name="o1_x" type="INTEGER" null="true"/> + <column name="o1_y" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1_x"/> + <column name="o1_y"/> + <references table="object1"> + <column name="id_x"/> + <column name="id_y"/> + </references> + </foreign-key> + <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1"> + <column name="num" options="DESC"/> + </index> + <index name="object_v_i"> + <column name="v_x"/> + <column name="v_y"/> + </index> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="BIGINT" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id_x" type="INTEGER" null="false"/> + <column name="id_y" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id_x"/> + <column name="id_y"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/model-sqlite-diff.xml b/common/changelog/model-sqlite-diff.xml new file mode 120000 index 0000000..3454f51 --- /dev/null +++ b/common/changelog/model-sqlite-diff.xml @@ -0,0 +1 @@ +model-sqlite.xml
\ No newline at end of file diff --git a/common/changelog/model-sqlite-patch.xml b/common/changelog/model-sqlite-patch.xml new file mode 120000 index 0000000..3454f51 --- /dev/null +++ b/common/changelog/model-sqlite-patch.xml @@ -0,0 +1 @@ +model-sqlite.xml
\ No newline at end of file diff --git a/common/changelog/model-sqlite.xml b/common/changelog/model-sqlite.xml new file mode 100644 index 0000000..9f22af0 --- /dev/null +++ b/common/changelog/model-sqlite.xml @@ -0,0 +1,56 @@ +<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" version="1"> + <model version="1"> + <table name="object"> + <column name="id" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="true" default="0" options="DUMMY=1"/> + <column name="v_x" type="INTEGER" null="false"/> + <column name="v_y" type="INTEGER" null="false"/> + <column name="o1_x" type="INTEGER" null="true"/> + <column name="o1_y" type="INTEGER" null="true"/> + <primary-key auto="true"> + <column name="id"/> + </primary-key> + <foreign-key name="o1_fk" deferred="true"> + <column name="o1_x"/> + <column name="o1_y"/> + <references table="object1"> + <column name="id_x"/> + <column name="id_y"/> + </references> + </foreign-key> + <index name="object_num_i" type="UNIQUE" method="BTREE" options="DUMMY=1"> + <column name="num" options="DESC"/> + </index> + <index name="object_v_i"> + <column name="v_x"/> + <column name="v_y"/> + </index> + </table> + <table name="object_nums"> + <column name="object_id" type="INTEGER" null="false"/> + <column name="index" type="INTEGER" null="false"/> + <column name="value" type="INTEGER" null="false"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="object_id"/> + <references table="object"> + <column name="id"/> + </references> + </foreign-key> + <index name="object_nums_object_id_i"> + <column name="object_id"/> + </index> + <index name="object_nums_index_i"> + <column name="index"/> + </index> + </table> + <table name="object1"> + <column name="id_x" type="INTEGER" null="false"/> + <column name="id_y" type="INTEGER" null="false"/> + <column name="num" type="INTEGER" null="false"/> + <primary-key> + <column name="id_x"/> + <column name="id_y"/> + </primary-key> + </table> + </model> +</changelog> diff --git a/common/changelog/model.hxx b/common/changelog/model.hxx new file mode 100644 index 0000000..e4c630e --- /dev/null +++ b/common/changelog/model.hxx @@ -0,0 +1,47 @@ +// file : common/changelog/model.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef MODEL_HXX +#define MODEL_HXX + +#include <vector> + +#pragma db model version(1, 1, true) + +#pragma db value +struct value +{ + int x; + int y; +}; + +struct object1; + +#pragma db object +struct object +{ + #pragma db id auto + int id; + + #pragma db null default(0) options("DUMMY=1") + int num; + + #pragma db index unique member(num, "DESC") method("BTREE") options("DUMMY=1") + + #pragma db index + value v; // Multi-column. + + std::vector<int> nums; + object1* o1; +}; + +#pragma db object +struct object1 +{ + #pragma db id + value id; // Multi-column. + int num; +}; + +#endif // MODEL_HXX diff --git a/common/makefile b/common/makefile index e6eca1e..3eb05e2 100644 --- a/common/makefile +++ b/common/makefile @@ -9,6 +9,7 @@ access \ auto \ blob \ callback \ +changelog \ circular/single \ circular/multiple \ composite \ @@ -54,6 +55,8 @@ wrapper thread_tests := threads cxx11_tests := session/custom +no_dist_tests := changelog include + default := $(out_base)/ dist := $(out_base)/.dist test := $(out_base)/.test @@ -73,7 +76,7 @@ $(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests))) name := common $(dist): name := $(name) -$(dist): export dirs := $(filter-out include,$(tests)) +$(dist): export dirs := $(filter-out $(no_dist_tests),$(tests)) $(dist): export thread_dirs := $(thread_tests) $(dist): export cxx11_dirs := $(cxx11_tests) $(dist): export extra_dist := test.bat $(call vc9slns,$(name)) \ |