source: trunk/fmgVen/etc/test-db/test-db-changelog.xml @ 38

Last change on this file since 38 was 28, checked in by fmguler, 14 years ago

Refs #3 - Ven.get() is converted to the new format. QueryGenerator and QueryMapper are mostly OK, generateRecursively and mapRecursively are converted and checked. Handles joins (includes/associations) many to one and one to many. For one to many, the reverse join field can be determined in a couple of ways. First way is (prefereed) having VenList as the list implementation which specifies the element class and the join field. Second way is using Java 1.5 generic type to detect element class (not yet implemented) and guessing join field by convention (if multiple joins exist, this won't work). The last way is to have some kind of annotation or configuration, which is of course the least preferred way. VenList has a static method to determine the element class in the object list, which currently calls getElementClass if the list is an instance of VenList. In the future other options can be implemented.

Getting object using joins (includes/associations) are tested using dummy assocations between SomeDomainObject and AnotherDomainObject. The Sample class builds the database, tests the operations and rolls back to the initial state. Database refactoring operations are moved to the LiquibaseUtil for clarity.

In the future, the generated queries will be shortened using hashed aliases, and the criteria subsystem will be implemented.

File size: 3.2 KB
RevLine 
[24]1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<databaseChangeLog logicalFilePath="database-schema.xml" xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
3    <changeSet author="fmguler" id="init">
4    </changeSet>
5    <changeSet author="fmguler" id="0">
[26]6        <tagDatabase tag="tag-init"/>
[24]7    </changeSet>
8    <!-- TEST SCHEMA >> -->
9    <changeSet author="fmguler" id="1">
[26]10        <createTable schemaName="public" tableName="some_domain_object">
11            <column autoIncrement="true" name="id" type="serial">
12                <constraints nullable="false" primaryKey="true" primaryKeyName="some_domain_object_pkey"/>
[24]13            </column>
[26]14            <column name="name" type="VARCHAR(100)"/>
15            <column name="description" type="TEXT(2147483647)"/>
16            <column name="date" type="TIMESTAMP WITHOUT TIME ZONE"/>
[28]17            <column name="another_domain_object_id" type="int"/>
[24]18        </createTable>
19    </changeSet>
20    <changeSet author="fmguler" id="2">
[28]21        <createTable schemaName="public" tableName="another_domain_object">
22            <column autoIncrement="true" name="id" type="serial">
23                <constraints nullable="false" primaryKey="true" primaryKeyName="another_domain_object_pkey"/>
24            </column>
25            <column name="name" type="VARCHAR(100)"/>
26            <column name="description" type="TEXT(2147483647)"/>
27            <column name="date" type="TIMESTAMP WITHOUT TIME ZONE"/>
28            <column name="some_domain_object_id" type="int"/>
29        </createTable>
[24]30    </changeSet>
31    <changeSet author="fmguler" id="3">
[28]32        <tagDatabase tag="tag-no-data"/>
33    </changeSet>
34    <changeSet author="fmguler" id="4">
[26]35        <insert schemaName="public" tableName="some_domain_object">
[28]36            <column name="name" value="sdo1"/>
37            <column name="description" value="sdo desc1"/>
[26]38            <column name="date" value="2010-10-13"/>
[28]39            <column name="another_domain_object_id" value="1"/>
[26]40        </insert>
41        <rollback>
42            delete from some_domain_object;
43        </rollback>
[24]44    </changeSet>
[28]45    <changeSet author="fmguler" id="5">
46        <insert schemaName="public" tableName="another_domain_object">
47            <column name="name" value="ado1"/>
48            <column name="description" value="ado desc1"/>
49            <column name="date" value="2011-01-19"/>
50            <column name="some_domain_object_id" value="1"/>
51        </insert>
52        <insert schemaName="public" tableName="another_domain_object">
53            <column name="name" value="ado2"/>
54            <column name="description" value="ado desc2"/>
55            <column name="date" value="2011-02-09"/>
56            <column name="some_domain_object_id" value="1"/>
57        </insert>
58        <rollback>
59            delete from another_domain_object;
60        </rollback>
[24]61    </changeSet>
[28]62    <changeSet author="fmguler" id="6">
63        <tagDatabase tag="tag-data"/>
64    </changeSet>
[26]65    <!-- << TEST SCHEMA -->
[24]66</databaseChangeLog>
Note: See TracBrowser for help on using the repository browser.