Don't commmit main, add admin flag

master
Andrew Sellers 4 years ago
parent 3c95df96c8
commit 8312f2a11a
  1. 1
      .gitignore
  2. BIN
      backend/main
  3. 22
      backend/migrations/1525898335_add_admin_flag_to_users.go
  4. 7
      backend/models/users.go

1
.gitignore vendored

@ -0,0 +1 @@
backend/main

Binary file not shown.

@ -0,0 +1,22 @@
package migrations
import (
"database/sql"
)
func init() {
InfraMigration(AddAdminFlagToUsers)
}
func AddAdminFlagToUsers(tx *sql.Tx, up bool) error {
var err error
err = Table("users").
Column("admin", Bool).
Change(tx, up)
if err != nil {
return err
}
return nil
}

@ -32,6 +32,7 @@ type User struct {
Active bool `boil:"active" json:"active" toml:"active" yaml:"active"`
OrganizationID null.Int `boil:"organization_id" json:"organization_id,omitempty" toml:"organization_id" yaml:"organization_id,omitempty"`
CalendarData types.JSON `boil:"calendar_data" json:"calendar_data" toml:"calendar_data" yaml:"calendar_data"`
Admin bool `boil:"admin" json:"admin" toml:"admin" yaml:"admin"`
R *userR `boil:"-" json:"-" toml:"-" yaml:"-"`
L userL `boil:"-" json:"-" toml:"-" yaml:"-"`
@ -47,6 +48,7 @@ var UserColumns = struct {
Active string
OrganizationID string
CalendarData string
Admin string
}{
ID: "id",
CreatedAt: "created_at",
@ -57,6 +59,7 @@ var UserColumns = struct {
Active: "active",
OrganizationID: "organization_id",
CalendarData: "calendar_data",
Admin: "admin",
}
// userR is where relationships are stored.
@ -71,8 +74,8 @@ type userR struct {
type userL struct{}
var (
userColumns = []string{"id", "created_at", "updated_at", "name", "email", "validated", "active", "organization_id", "calendar_data"}
userColumnsWithoutDefault = []string{"name", "email", "validated", "active", "organization_id", "calendar_data"}
userColumns = []string{"id", "created_at", "updated_at", "name", "email", "validated", "active", "organization_id", "calendar_data", "admin"}
userColumnsWithoutDefault = []string{"name", "email", "validated", "active", "organization_id", "calendar_data", "admin"}
userColumnsWithDefault = []string{"id", "created_at", "updated_at"}
userPrimaryKeyColumns = []string{"id"}
)

Loading…
Cancel
Save