aboutsummaryrefslogtreecommitdiff
path: root/libbrep/package-031-pre.sql
blob: 36a6bbf684cca469c7c3184308adb5e23d579c59 (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
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
/* This file was generated by ODB, object-relational mapping (ORM)
 * compiler for C++.
 */

CREATE TABLE "package_build_auxiliaries" (
  "tenant" TEXT NOT NULL,
  "name" CITEXT NOT NULL,
  "version_epoch" INTEGER NOT NULL,
  "version_canonical_upstream" TEXT NOT NULL,
  "version_canonical_release" TEXT NOT NULL COLLATE "C",
  "version_revision" INTEGER NOT NULL,
  "index" BIGINT NOT NULL,
  "environment_name" TEXT NOT NULL,
  "config" TEXT NOT NULL,
  "comment" TEXT NOT NULL);

CREATE INDEX "package_build_auxiliaries_object_id_i"
  ON "package_build_auxiliaries" (
    "tenant",
    "name",
    "version_epoch",
    "version_canonical_upstream",
    "version_canonical_release",
    "version_revision");

CREATE INDEX "package_build_auxiliaries_index_i"
  ON "package_build_auxiliaries" ("index");

CREATE TABLE "package_build_config_auxiliaries" (
  "tenant" TEXT NOT NULL,
  "name" CITEXT NOT NULL,
  "version_epoch" INTEGER NOT NULL,
  "version_canonical_upstream" TEXT NOT NULL,
  "version_canonical_release" TEXT NOT NULL COLLATE "C",
  "version_revision" INTEGER NOT NULL,
  "config_index" BIGINT NOT NULL,
  "index" BIGINT NOT NULL,
  "environment_name" TEXT NOT NULL,
  "config" TEXT NOT NULL,
  "comment" TEXT NOT NULL);

CREATE INDEX "package_build_config_auxiliaries_object_id_i"
  ON "package_build_config_auxiliaries" (
    "tenant",
    "name",
    "version_epoch",
    "version_canonical_upstream",
    "version_canonical_release",
    "version_revision");

ALTER TABLE "package_build_auxiliaries"
  ADD CONSTRAINT "tenant_fk"
    FOREIGN KEY ("tenant")
    REFERENCES "tenant" ("id")
    INITIALLY DEFERRED,
  ADD CONSTRAINT "object_id_fk"
    FOREIGN KEY ("tenant",
                 "name",
                 "version_epoch",
                 "version_canonical_upstream",
                 "version_canonical_release",
                 "version_revision")
    REFERENCES "package" ("tenant",
                          "name",
                          "version_epoch",
                          "version_canonical_upstream",
                          "version_canonical_release",
                          "version_revision")
    ON DELETE CASCADE;

ALTER TABLE "package_build_config_auxiliaries"
  ADD CONSTRAINT "tenant_fk"
    FOREIGN KEY ("tenant")
    REFERENCES "tenant" ("id")
    INITIALLY DEFERRED,
  ADD CONSTRAINT "object_id_fk"
    FOREIGN KEY ("tenant",
                 "name",
                 "version_epoch",
                 "version_canonical_upstream",
                 "version_canonical_release",
                 "version_revision")
    REFERENCES "package" ("tenant",
                          "name",
                          "version_epoch",
                          "version_canonical_upstream",
                          "version_canonical_release",
                          "version_revision")
    ON DELETE CASCADE;

UPDATE "schema_version"
  SET "version" = 31, "migration" = TRUE
  WHERE "name" = 'package';