1

Update SQL

This commit is contained in:
Alex Yatskov 2015-08-23 16:54:49 +09:00
parent 0d3af72b6b
commit f25ebfebbd

View File

@ -128,8 +128,8 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
longitude FLOAT NOT NULL, longitude FLOAT NOT NULL,
closestStnDist FLOAT NOT NULL, closestStnDist FLOAT NOT NULL,
closestStnName VARCHAR(100) NOT NULL, closestStnName VARCHAR(100) NOT NULL,
accessCount INT NOT NULL, accessCount INTEGER NOT NULL,
id INT PRIMARY KEY id INTEGER PRIMARY KEY
)`) )`)
if err != nil { if err != nil {
@ -178,7 +178,7 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
DROP TABLE IF EXISTS categories; DROP TABLE IF EXISTS categories;
CREATE TABLE categories( CREATE TABLE categories(
description VARCHAR(200) NOT NULL, description VARCHAR(200) NOT NULL,
id INT PRIMARY KEY)`) id INTEGER PRIMARY KEY)`)
if err != nil { if err != nil {
return err return err
@ -198,8 +198,8 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
DROP TABLE IF EXISTS history; DROP TABLE IF EXISTS history;
CREATE TABLE history( CREATE TABLE history(
date DATETIME NOT NULL, date DATETIME NOT NULL,
reviewId INT NOT NULL, reviewId INTEGER NOT NULL,
id INT PRIMARY KEY, id INTEGER PRIMARY KEY,
FOREIGN KEY(reviewId) REFERENCES reviews(id))`) FOREIGN KEY(reviewId) REFERENCES reviews(id))`)
if err != nil { if err != nil {
@ -213,9 +213,9 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
_, err = db.Exec(` _, err = db.Exec(`
DROP TABLE IF EXISTS historyGroups; DROP TABLE IF EXISTS historyGroups;
CREATE TABLE historyGroups( CREATE TABLE historyGroups(
categoryId INT NOT NULL, categoryId INTEGER NOT NULL,
categoryValue FLOAT NOT NULL, categoryValue FLOAT NOT NULL,
historyId INT NOT NULL, historyId INTEGER NOT NULL,
FOREIGN KEY(historyId) REFERENCES history(id), FOREIGN KEY(historyId) REFERENCES history(id),
FOREIGN KEY(categoryId) REFERENCES categories(id))`) FOREIGN KEY(categoryId) REFERENCES categories(id))`)