@@ 65,10 65,18 @@ func migrations() []string {
fmt.Sprintf(`CREATE TABLE %s (
schema_version INTEGER
)`, migrationsTable),
- fmt.Sprintf(`CREATE TABLE domains (
+ fmt.Sprintf(`CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY,
+ email TEXT NOT NULL,
+ pwd TEXT NOT NULL,
+ is_admin INTEGER DEFAULT FALSE NOT NULL
+ )`),
+ fmt.Sprintf(`CREATE TABLE domains (
+ id TEXT NOT NULL PRIMARY KEY,
+ owner INTEGER NOT NULL,
ddns_domain TEXT,
- a_record TEXT
+ a_record TEXT,
+ FOREIGN KEY(owner) REFERENCES users(id)
)`),
}
}