cascades
This commit is contained in:
parent
a088db3c7b
commit
e60d00ae00
@ -60,7 +60,7 @@ func Ingest(o IngestOpts) error {
|
|||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
sourceid char(7) NOT NULL,
|
sourceid char(7) NOT NULL,
|
||||||
phrase TEXT,
|
phrase TEXT,
|
||||||
FOREIGN KEY (sourceid) REFERENCES sources(id)
|
FOREIGN KEY (sourceid) REFERENCES sources(id) ON DELETE CASCADE
|
||||||
)`, tablename))
|
)`, tablename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not create table '%s': %w", tablename, err)
|
return fmt.Errorf("could not create table '%s': %w", tablename, err)
|
||||||
|
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS sources (
|
|||||||
corpusid char(7) NOT NULL,
|
corpusid char(7) NOT NULL,
|
||||||
name TEXT UNIQUE,
|
name TEXT UNIQUE,
|
||||||
|
|
||||||
FOREIGN KEY (corpusid) REFERENCES corpora(id)
|
FOREIGN KEY (corpusid) REFERENCES corpora(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
-- CREATE TABLE IF NOT EXISTS phrases (
|
-- CREATE TABLE IF NOT EXISTS phrases (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user