diff options
| author | Max | 2018-02-08 01:02:45 +0100 |
|---|---|---|
| committer | Max | 2018-02-08 01:02:45 +0100 |
| commit | 43fa5257b7d5b0b14131bd684c12a12e10072210 (patch) | |
| tree | fb07182e1ae99ce2b4f666cab6dd73cfa49e196a /crawler | |
| parent | 14a89c34096d2ddb2a7750feda143207110e838b (diff) | |
| download | alkobote-43fa5257b7d5b0b14131bd684c12a12e10072210.tar.gz | |
Adds database view.
Diffstat (limited to 'crawler')
| -rw-r--r-- | crawler/database.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crawler/database.go b/crawler/database.go index a6145bb..741028f 100644 --- a/crawler/database.go +++ b/crawler/database.go @@ -33,6 +33,13 @@ func (app *App) createTables() error { FOREIGN KEY(shop) REFERENCES shop(id) )` _, err = app.DB.Exec(query2) + if err != nil { + return err + } + + query3 := `CREATE OR REPLACE VIEW angebote AS SELECT angebot.name,angebot.url,original_price, discounted_price,image_url,shop.name as shop, shop.url as shop_url, (original_price/discounted_price) AS quotient FROM angebot JOIN shop ON angebot.shop = shop.id WHERE spirit_type = "Whisky" AND original_price > 1998` + _, err = app.DB.Exec(query3) + return err } |
