File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ func NewSQLLiteLoader(outFilename string) (*SQLLoader, error) {
35
35
CREATE TABLE IF NOT EXISTS package (
36
36
name TEXT PRIMARY KEY,
37
37
default_channel TEXT,
38
- FOREIGN KEY(default_channel) REFERENCES channel(name)
38
+ FOREIGN KEY(name, default_channel) REFERENCES channel(package_name, name)
39
39
);
40
40
CREATE TABLE IF NOT EXISTS channel (
41
41
name TEXT,
@@ -53,9 +53,7 @@ func NewSQLLiteLoader(outFilename string) (*SQLLoader, error) {
53
53
replaces INTEGER,
54
54
depth INTEGER,
55
55
FOREIGN KEY(replaces) REFERENCES channel_entry(entry_id) DEFERRABLE INITIALLY DEFERRED,
56
- FOREIGN KEY(channel_name) REFERENCES channel(name),
57
- FOREIGN KEY(package_name) REFERENCES channel(package_name),
58
- FOREIGN KEY(operatorbundle_name) REFERENCES operatorbundle(name)
56
+ FOREIGN KEY(channel_name, package_name) REFERENCES channel(name, package_name)
59
57
);
60
58
CREATE TABLE IF NOT EXISTS api (
61
59
group_name TEXT,
@@ -74,6 +72,10 @@ func NewSQLLiteLoader(outFilename string) (*SQLLoader, error) {
74
72
);
75
73
`
76
74
75
+ if _ , err := db .Exec ("PRAGMA foreign_keys = ON" , nil ); err != nil {
76
+ return nil , err
77
+ }
78
+
77
79
if _ , err = db .Exec (createTable ); err != nil {
78
80
return nil , err
79
81
}
You can’t perform that action at this time.
0 commit comments