You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the schema to rename groups to usergroups. This allows for the
table name and means to access it to be consistent across all databases.
This is due to mysql reserving the name groups as a keyword.
Signed-off-by: Billy Olsen <[email protected]>
Copy file name to clipboardExpand all lines: mysql.go
+23-2Lines changed: 23 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"database/sql"
5
+
"fmt"
5
6
6
7
_ "github.com/go-sql-driver/mysql"
7
8
@@ -50,9 +51,9 @@ CREATE TABLE IF NOT EXISTS users (
50
51
statement.Exec()
51
52
statement, _=db.Prepare("CREATE UNIQUE INDEX idx_user_name on users(name)")
52
53
statement.Exec()
53
-
statement, _=db.Prepare("CREATE TABLE IF NOT EXISTS `groups` (id INTEGER AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64) NOT NULL, gidnumber INTEGER NOT NULL)")
54
+
statement, _=db.Prepare("CREATE TABLE IF NOT EXISTS usergroups (id INTEGER AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64) NOT NULL, gidnumber INTEGER NOT NULL)")
54
55
statement.Exec()
55
-
statement, _=db.Prepare("CREATE UNIQUE INDEX idx_group_name on `groups`(name)")
56
+
statement, _=db.Prepare("CREATE UNIQUE INDEX idx_group_name on usergroups(name)")
56
57
statement.Exec()
57
58
statement, _=db.Prepare("CREATE TABLE IF NOT EXISTS includegroups (id INTEGER AUTO_INCREMENT PRIMARY KEY, parentgroupid INTEGER NOT NULL, includegroupid INTEGER NOT NULL)")
0 commit comments