Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
7d70ffe2
Commit
7d70ffe2
authored
Jan 18, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding more columns for account table migration
parent
a64a38d7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
pkg/services/sqlstore/migrations/migrations.go
+20
-4
pkg/services/sqlstore/migrations/migrations_test.go
+1
-1
No files found.
pkg/services/sqlstore/migrations/migrations.go
View file @
7d70ffe2
...
...
@@ -25,22 +25,38 @@ func AddMigrations(mg *Migrator) {
CREATE TABLE account (
id INTEGER PRIMARY KEY AUTOINCREMENT,
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
(
`
CREATE TABLE account (
id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id),
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
)
.
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
{
...
...
pkg/services/sqlstore/migrations/migrations_test.go
View file @
7d70ffe2
...
...
@@ -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:"
},
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment