summaryrefslogtreecommitdiff
path: root/odb-tests/common/changelog/testscript
blob: 936893848abbafd7e5a1cd99bffe3578487efc47 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# file      : common/changelog/testscript
# license   : GNU GPL v2; see accompanying LICENSE file

headers = [paths] $path_search($src_base/*.hxx)

odb_options = --generate-schema-only \
              --schema-format sql \
              --suppress-migration \
              --options-file $out_base/odb.options

: mysql
:
if $mysql
{
  odb_options += --database 'mysql' --changelog-dir $~

  for h: $headers
    n = $base($leaf($h))

    $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql

    $* $odb_options -DBVER=1 -DCVER=2 $h
    diff $src_base/$n-mysql-diff.xml $(n).xml

    $* $odb_options -DBVER=2 -DCVER=3 $h
    diff $src_base/$n-mysql-patch.xml $(n).xml
  end
}

: sqlite
:
if $sqlite
{
  odb_options += --database 'sqlite' --changelog-dir $~

  for h: $headers
    n = $base($leaf($h))

    $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql

    $* $odb_options -DBVER=1 -DCVER=2 $h
    diff $src_base/$n-sqlite-diff.xml $(n).xml

    $* $odb_options -DBVER=2 -DCVER=3 $h
    diff $src_base/$n-sqlite-patch.xml $(n).xml
  end
}

: pgsql
:
if $pgsql
{
  odb_options += --database 'pgsql' --changelog-dir $~

  for h: $headers
    n = $base($leaf($h))

    $* $odb_options -DBVER=1 -DCVER=1 --init-changelog $h &$(n).xml &$(n).sql

    $* $odb_options -DBVER=1 -DCVER=2 $h
    diff $src_base/$n-pgsql-diff.xml $(n).xml

    $* $odb_options -DBVER=2 -DCVER=3 $h
    diff $src_base/$n-pgsql-patch.xml $(n).xml
  end
}