mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-03 03:27:13 +08:00
Added friends table to the db
This commit is contained in:
parent
df92ff8b6f
commit
d5a7b7042a
9
db/db.go
9
db/db.go
@ -176,6 +176,15 @@ func setupDb(tx *sql.Tx) error {
|
|||||||
|
|
||||||
`ALTER TABLE sessions DROP COLUMN IF EXISTS active`,
|
`ALTER TABLE sessions DROP COLUMN IF EXISTS active`,
|
||||||
`CREATE TABLE IF NOT EXISTS activeClientSessions (uuid BINARY(16) NOT NULL PRIMARY KEY, clientSessionId VARCHAR(32) NOT NULL, FOREIGN KEY (uuid) REFERENCES accounts (uuid) ON DELETE CASCADE ON UPDATE CASCADE)`,
|
`CREATE TABLE IF NOT EXISTS activeClientSessions (uuid BINARY(16) NOT NULL PRIMARY KEY, clientSessionId VARCHAR(32) NOT NULL, FOREIGN KEY (uuid) REFERENCES accounts (uuid) ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||||
|
|
||||||
|
`CREATE TABLE IF NOT EXISTS friends (
|
||||||
|
relationId INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
user VARCHAR(16) NOT NULL,
|
||||||
|
friend VARCHAR(16) NOT NULL,
|
||||||
|
since DATE NOT NULL,
|
||||||
|
FOREIGN KEY (user) REFERENCES accounts (username) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
FOREIGN KEY (friend) REFERENCES accounts (username) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
)`,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, q := range queries {
|
for _, q := range queries {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user