forked from tildetown/town
finish review for now; start on welcome
parent
ced73adb77
commit
fca0ecae4e
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("welcome")
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,17 @@
|
|||
package review
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
const dsn = "/town/var/users.db?mode=rw"
|
||||
|
||||
func ConnectDB() (*sql.DB, error) {
|
||||
db, err := sql.Open("sqlite3", dsn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return db, nil
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
dbpath="/town/var/invites/invites.db"
|
||||
srcpath="/town/src/town"
|
||||
|
||||
rm -f "$dbpath"
|
||||
sqlite3 < "${srcpath}/sql/create_invites_db.sql" "$dbpath"
|
||||
chown welcome:admin "$dbpath"
|
||||
chmod o-r "$dbpath"
|
||||
chmod g+w "$dbpath"
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
dbpath="/town/var/signups/signups.db"
|
||||
srcpath="/town/src/town"
|
||||
|
||||
rm -f "$dbpath"
|
||||
sqlite3 < "${srcpath}/sql/create_signups_db.sql" "$dbpath"
|
||||
chown join:admin "$dbpath"
|
||||
chmod o-r "$dbpath"
|
||||
chmod g+w "$dbpath"
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS invites (
|
||||
id INTEGER PRIMARY KEY,
|
||||
created TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M', 'now', 'localtime')),
|
||||
code TEXT,
|
||||
email TEXT,
|
||||
used INTEGER DEFAULT 0
|
||||
);
|
|
@ -28,18 +28,9 @@ CREATE TABLE IF NOT EXISTS user_notes (
|
|||
|
||||
CREATE TABLE IF NOT EXISTS notes (
|
||||
id INTEGER PRIMARY KEY,
|
||||
adminid INTEGER,
|
||||
text TEXT,
|
||||
author INTEGER,
|
||||
content TEXT,
|
||||
created TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M', 'now', 'localtime')),
|
||||
|
||||
FOREIGN KEY (adminid) REFERENCES users(adminid)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS signup_notes (
|
||||
noteid INTEGER,
|
||||
signupid INTEGER,
|
||||
|
||||
PRIMARY KEY (noteid, signupid),
|
||||
FOREIGN KEY (noteid) REFERENCES notes(noteid),
|
||||
FOREIGN KEY (signupid) REFERENCES signups(signupid)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue