File: dbstruct.xml

package info (click to toggle)
libgda5 5.2.10-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,168 kB
  • sloc: ansic: 495,319; xml: 10,486; yacc: 5,165; sh: 4,451; makefile: 4,095; php: 1,416; java: 1,300; javascript: 1,298; python: 896; sql: 879; perl: 116
file content (119 lines) | stat: -rw-r--r-- 3,805 bytes parent folder | download | duplicates (9)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0" encoding="UTF-8"?>
<!--
   Tests databases schema
-->


<schema>
  <!-- provider specific information 
       use <replace> to replace something with something else (context can only be "/FIELDS_A/@COLUMN_TYPE" at the moment)
       use <ignore> to ignore some parts (context can only be "/FKEY_S" or "/FIELDS_A/@COLUMN_PKEY" at the moment)
    -->
  <specifics>
    <provider name="PostgreSQL">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="varchar"/>
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
    </provider>

    <provider name="MySQL">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="text"/>
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
      <ignore context="/FKEY_S"/>
      <ignore context="/FIELDS_A/@COLUMN_PKEY"/>
    </provider>

    <provider name="SQLite">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
    </provider>
  </specifics>

  <!-- actor table -->
  <table name="actor"> <!-- possibly also schema attribute -->
    <column name="actor_id" type="gint" pkey="TRUE" autoinc="TRUE"/>
    <column name="first_name"/>
    <column name="last_name"/>
    <column name="last_update" type="timestamp">
      <default symbolic="now"/>
    </column>
  </table>

  <!-- film table -->
  <table name="film">
    <column name="film_id" type="gint" pkey="TRUE" autoinc="TRUE"/>
    <column name="title"/>
    <column name="description" type="date"/>
    <column name="language_id" type="gint"/>
    <column name="original_language_id" type="gint" nullok="TRUE"/>
    <column name="rental_duration" type="smallint">
      <extra context="COLUMN_DEFAULT">3</extra>
    </column>
    <column name="rental_rate" type="numeric(4,2)">
      <extra context="COLUMN_DEFAULT">4.99</extra>
    </column>
    <column name="replacement_cost" type="numeric(5,2)">
      <extra context="COLUMN_DEFAULT">19.99</extra>
    </column>
    <column name="rating" nullok="TRUE">
      <extra context="COLUMN_DEFAULT">G</extra>
    </column>
    <column name="special_features" type="[string]"/>
    <column name="last_update" type="timestamp">
      <provider name="SQLite">
	<extra context="COLUMN_DEFAULT">CURRENT_TIMESTAMP</extra>
      </provider>
      <provider name="PostgreSQL">
	<extra context="COLUMN_DEFAULT">now()</extra>
      </provider>
    </column>

    <check>((((rating = 'G') OR (rating = 'PG')) OR (rating = 'PG-13')) OR (rating = 'R')) OR (rating = 'NC-17')</check>

    <fkey ref_table="language">
      <part column="language_id" ref_column="language_id"/>
    </fkey>

    <fkey ref_table="language">
      <part column="original_language_id" ref_column="language_id"/>
    </fkey>
  </table>

  <!-- film_actor table -->
  <table name="film_actor">
    <column name="actor_id" type="gint"/>
    <column name="film_id" type="gint"/>
    <column name="last_update" type="timestamp">
      <default symbolic="now"/>
    </column>

    <fkey ref_table="actor">
      <part column="actor_id" ref_column="actor_id"/>
    </fkey>

    <fkey ref_table="film">
      <part column="film_id" ref_column="film_id"/>
    </fkey>
  </table>

  <!-- language table -->
  <table name="language">
    <column name="language_id" type="gint" pkey="TRUE" autoinc="TRUE"/>
    <column name="name"/>
    <column name="last_update" type="timestamp">
      <default symbolic="now"/>
    </column>
  </table>

  <!-- dummy table -->
  <table name="dummy">
    <column name="name"/>
    <unique>
      <column name="name"/>
    </unique>
  </table>

  <!-- films_ordered view -->
  <view name="films_ordered" descr="Ordered list of films">
    <definition>SELECT * FROM films ORDER BY last_update</definition>
  </view>

</schema>