From 7d70ffe2016fd2b0519d3118786da137d6dfd5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 18 Jan 2015 20:09:30 +0100 Subject: [PATCH] adding more columns for account table migration --- .../sqlstore/migrations/migrations.go | 32 ++++++++++++++----- .../sqlstore/migrations/migrations_test.go | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/pkg/services/sqlstore/migrations/migrations.go b/pkg/services/sqlstore/migrations/migrations.go index 32cc7f8e8e6..edd35ec52a0 100644 --- a/pkg/services/sqlstore/migrations/migrations.go +++ b/pkg/services/sqlstore/migrations/migrations.go @@ -23,24 +23,40 @@ func AddMigrations(mg *Migrator) { mg.AddMigration("create account table", new(RawSqlMigration). Sqlite(` CREATE TABLE account ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - login TEXT NOT NULL, - email TEXT NOT NULL + id INTEGER PRIMARY KEY AUTOINCREMENT, + login 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(` CREATE TABLE account ( - id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), - login VARCHAR(255) NOT NULL, - email VARCHAR(255) NOT NULL + id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), + login 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). Name("UIX_account_login").Table("account").Columns("login")) // ------------------------------ - mg.AddMigration("add column", new(AddColumnMigration). - Table("account").Column("name").Type(DB_TYPE_STRING).Length(255)) + // mg.AddMigration("add column", new(AddColumnMigration). + // Table("account").Column("name").Type(DB_TYPE_STRING).Length(255)) } type MigrationLog struct { diff --git a/pkg/services/sqlstore/migrations/migrations_test.go b/pkg/services/sqlstore/migrations/migrations_test.go index e485292f4a4..112e1aeb94d 100644 --- a/pkg/services/sqlstore/migrations/migrations_test.go +++ b/pkg/services/sqlstore/migrations/migrations_test.go @@ -35,7 +35,7 @@ func TestMigrations(t *testing.T) { log.NewLogger(0, "console", `{"level": 0}`) 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:"}, }