mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 01:41:24 -06:00
Fixed gofmt formating, updated precommit hook
This commit is contained in:
parent
d8005af8ee
commit
ebad9cb502
7
.hooks/pre-commit
Executable file
7
.hooks/pre-commit
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "Some files aren't formatted, please run 'go fmt ./pkg/...' to format your source code before committing"
|
||||
exit 1
|
||||
fi
|
@ -6,23 +6,23 @@ func addUserMigrations(mg *Migrator) {
|
||||
userV1 := Table{
|
||||
Name: "user",
|
||||
Columns: []*Column{
|
||||
&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
&Column{Name: "version", Type: DB_Int, Nullable: false},
|
||||
&Column{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
&Column{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
&Column{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
&Column{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "account_id", Type: DB_BigInt, Nullable: false},
|
||||
&Column{Name: "is_admin", Type: DB_Bool, Nullable: false},
|
||||
&Column{Name: "created", Type: DB_DateTime, Nullable: false},
|
||||
&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
|
||||
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "version", Type: DB_Int, Nullable: false},
|
||||
{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "account_id", Type: DB_BigInt, Nullable: false},
|
||||
{Name: "is_admin", Type: DB_Bool, Nullable: false},
|
||||
{Name: "created", Type: DB_DateTime, Nullable: false},
|
||||
{Name: "updated", Type: DB_DateTime, Nullable: false},
|
||||
},
|
||||
Indices: []*Index{
|
||||
&Index{Cols: []string{"login"}, Type: UniqueIndex},
|
||||
&Index{Cols: []string{"email"}, Type: UniqueIndex},
|
||||
{Cols: []string{"login"}, Type: UniqueIndex},
|
||||
{Cols: []string{"email"}, Type: UniqueIndex},
|
||||
},
|
||||
}
|
||||
|
||||
@ -45,25 +45,25 @@ func addUserMigrations(mg *Migrator) {
|
||||
userV2 := Table{
|
||||
Name: "user",
|
||||
Columns: []*Column{
|
||||
&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
&Column{Name: "version", Type: DB_Int, Nullable: false},
|
||||
&Column{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
&Column{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
&Column{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
&Column{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "org_id", Type: DB_BigInt, Nullable: false},
|
||||
&Column{Name: "is_admin", Type: DB_Bool, Nullable: false},
|
||||
&Column{Name: "email_verified", Type: DB_Bool, Nullable: true},
|
||||
&Column{Name: "theme", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
&Column{Name: "created", Type: DB_DateTime, Nullable: false},
|
||||
&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
|
||||
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "version", Type: DB_Int, Nullable: false},
|
||||
{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
|
||||
{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "org_id", Type: DB_BigInt, Nullable: false},
|
||||
{Name: "is_admin", Type: DB_Bool, Nullable: false},
|
||||
{Name: "email_verified", Type: DB_Bool, Nullable: true},
|
||||
{Name: "theme", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "created", Type: DB_DateTime, Nullable: false},
|
||||
{Name: "updated", Type: DB_DateTime, Nullable: false},
|
||||
},
|
||||
Indices: []*Index{
|
||||
&Index{Cols: []string{"login"}, Type: UniqueIndex},
|
||||
&Index{Cols: []string{"email"}, Type: UniqueIndex},
|
||||
{Cols: []string{"login"}, Type: UniqueIndex},
|
||||
{Cols: []string{"email"}, Type: UniqueIndex},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@ package sqlstore
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func TestUserStarsDataAccess(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user