From 61ba5dcc29a16bb3727209a76ee75fffff037dee Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 11 Dec 2025 15:09:30 -0500 Subject: Add commenting system --- internal/dbmigrations.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/dbmigrations.go') 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) + } + } } -- cgit v1.2.3