diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/dbmigrations.go | 2 | ||||
| -rw-r--r-- | internal/models/post.go | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/internal/dbmigrations.go b/internal/dbmigrations.go index e6c11ff..d5f4836 100644 --- a/internal/dbmigrations.go +++ b/internal/dbmigrations.go @@ -33,7 +33,7 @@ func Migrate (db *sql.DB, webmaster string, passOne string, passTwo string) { _, table_check = db.Query("SELECT * FROM posts;") if table_check != nil { - _, err := db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES logins(id), time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, content TEXT NOT NULL);") + _, err := db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES logins(id), time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, brief TEXT NOT NULL, content TEXT NOT NULL);") if err != nil { fmt.Fprintf(os.Stderr, "Unable to create posts table: %v\n", err) os.Exit(1) diff --git a/internal/models/post.go b/internal/models/post.go index d7b006d..d7f1aaa 100644 --- a/internal/models/post.go +++ b/internal/models/post.go @@ -1,10 +1,15 @@ package models -import "html/template" +import ( + "html/template" + "time" +) type Post struct { Id int Name string - Time string + Time time.Time + FormattedTime string + Brief template.HTML Content template.HTML } |
