aboutsummaryrefslogtreecommitdiff
path: root/internal/dbmigrations.go
diff options
context:
space:
mode:
authorSamuel Johnson <[email protected]>2025-12-11 15:09:30 -0500
committerSamuel Johnson <[email protected]>2025-12-11 15:09:30 -0500
commit61ba5dcc29a16bb3727209a76ee75fffff037dee (patch)
tree4505ebfe8aadeae024e2f36fb948f9e79841a0f1 /internal/dbmigrations.go
parent154e2a5417bca37cd7474f4e16fd8901844e473f (diff)
Add commenting system
Diffstat (limited to 'internal/dbmigrations.go')
-rw-r--r--internal/dbmigrations.go8
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)
+ }
+ }
}