27 lines
628 B
Go
27 lines
628 B
Go
package common
|
|
|
|
import (
|
|
"zombiezen.com/go/sqlite"
|
|
"zombiezen.com/go/sqlite/sqlitex"
|
|
)
|
|
|
|
// Represents a web user in the game.
|
|
type WebUser struct {
|
|
ID int64 `db:"id"`
|
|
Username string `db:"username"`
|
|
Passwd string `db:"passwd"`
|
|
Status int32 `db:"status"`
|
|
}
|
|
|
|
// Creates the web_users table if it does not exist.
|
|
func CreateWebUsersTable(conn *sqlite.Conn) error {
|
|
return sqlitex.ExecScript(conn, `
|
|
CREATE TABLE IF NOT EXISTS web_users (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
username TEXT NOT NULL DEFAULT '',
|
|
passwd TEXT NOT NULL DEFAULT '',
|
|
status INTEGER NOT NULL DEFAULT 0
|
|
);
|
|
`)
|
|
}
|