summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crawler/database.go7
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
}