aboutsummaryrefslogtreecommitdiff
path: root/common/changelog/add-table-mysql-diff.xml
blob: 19bca231b4b6e14f09bc4f30d801e24284970ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" 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" deferrable="DEFERRED">
        <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>