diff options
Diffstat (limited to 'internal/dbmigrations.go')
| -rw-r--r-- | internal/dbmigrations.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/dbmigrations.go b/internal/dbmigrations.go index fcbaaaf..41180c7 100644 --- a/internal/dbmigrations.go +++ b/internal/dbmigrations.go @@ -56,4 +56,12 @@ func Migrate(db *sql.DB, webmaster string, passOne string, passTwo string) { fmt.Fprintf(os.Stderr, "Unable to create cookies table: %v\n", err) } } + + _, table_check = db.Query("SELECT * FROM comments;") + if table_check != nil { + _, err := db.Exec("CREATE TABLE comments (id SERIAL PRIMARY KEY, verified BOOLEAN NOT NULL, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, name TEXT NOT NULL, post_id INTEGER REFERENCES posts(id), content TEXT NOT NULL);") + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to create comments table: %v\n", err) + } + } } |
