Commit 7d70ffe2 by Torkel Ödegaard

adding more columns for account table migration

parent a64a38d7
...@@ -23,24 +23,40 @@ func AddMigrations(mg *Migrator) { ...@@ -23,24 +23,40 @@ func AddMigrations(mg *Migrator) {
mg.AddMigration("create account table", new(RawSqlMigration). mg.AddMigration("create account table", new(RawSqlMigration).
Sqlite(` Sqlite(`
CREATE TABLE account ( CREATE TABLE account (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
login TEXT NOT NULL, login TEXT NOT NULL,
email TEXT NOT NULL email TEXT NOT NULL,
name TEXT NULL,
password TEXT NULL,
salt TEXT NULL,
company TEXT NULL,
using_account_id INTEGER NULL,
is_admin INTEGER NOT NULL,
created INTEGER NOT NULL,
updated INTEGER NOT NULL
) )
`). `).
Mysql(` Mysql(`
CREATE TABLE account ( CREATE TABLE account (
id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id),
login VARCHAR(255) NOT NULL, login VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL email VARCHAR(255) NOT NULL,
name VARCHAR(255) NULL,
password VARCHAR(50) NULL,
salt VARCHAR(50) NULL,
company VARCHAR(255) NULL,
using_account_id BIGINT NULL,
is_admin BOOL NOT NULL,
created DATETIME NOT NULL,
update DATETIME NOT NULL
) )
`)) `))
// ------------------------------ // ------------------------------
mg.AddMigration("add index UIX_account.login", new(AddIndexMigration). mg.AddMigration("add index UIX_account.login", new(AddIndexMigration).
Name("UIX_account_login").Table("account").Columns("login")) Name("UIX_account_login").Table("account").Columns("login"))
// ------------------------------ // ------------------------------
mg.AddMigration("add column", new(AddColumnMigration). // mg.AddMigration("add column", new(AddColumnMigration).
Table("account").Column("name").Type(DB_TYPE_STRING).Length(255)) // Table("account").Column("name").Type(DB_TYPE_STRING).Length(255))
} }
type MigrationLog struct { type MigrationLog struct {
......
...@@ -35,7 +35,7 @@ func TestMigrations(t *testing.T) { ...@@ -35,7 +35,7 @@ func TestMigrations(t *testing.T) {
log.NewLogger(0, "console", `{"level": 0}`) log.NewLogger(0, "console", `{"level": 0}`)
testDBs := [][]string{ testDBs := [][]string{
[]string{"mysql", "grafana:password@tcp(localhost:3306)/grafana_tests?charset=utf8"}, //[]string{"mysql", "grafana:password@tcp(localhost:3306)/grafana_tests?charset=utf8"},
[]string{"sqlite3", ":memory:"}, []string{"sqlite3", ":memory:"},
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment