improve documentation
This commit is contained in:
parent
232463e1db
commit
0826963742
16 changed files with 80 additions and 28 deletions
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/go-pg/migrations"
|
||||
)
|
||||
|
||||
const AccountTable = `
|
||||
const accountTable = `
|
||||
CREATE TABLE accounts (
|
||||
id serial NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL DEFAULT current_timestamp,
|
||||
|
|
@ -19,7 +19,7 @@ roles text[] NOT NULL DEFAULT '{"user"}',
|
|||
PRIMARY KEY (id)
|
||||
)`
|
||||
|
||||
const TokenTable = `
|
||||
const tokenTable = `
|
||||
CREATE TABLE tokens (
|
||||
id serial NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL DEFAULT current_timestamp,
|
||||
|
|
@ -34,8 +34,8 @@ PRIMARY KEY (id)
|
|||
|
||||
func init() {
|
||||
up := []string{
|
||||
AccountTable,
|
||||
TokenTable,
|
||||
accountTable,
|
||||
tokenTable,
|
||||
}
|
||||
|
||||
down := []string{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/go-pg/migrations"
|
||||
)
|
||||
|
||||
const ProfileTable = `
|
||||
const profileTable = `
|
||||
CREATE TABLE profiles (
|
||||
id serial NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL DEFAULT current_timestamp,
|
||||
|
|
@ -23,7 +23,7 @@ INSERT INTO profiles(account_id) VALUES(2);
|
|||
|
||||
func init() {
|
||||
up := []string{
|
||||
ProfileTable,
|
||||
profileTable,
|
||||
bootstrapAccountProfiles,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/go-pg/pg"
|
||||
)
|
||||
|
||||
// Migrate runs go-pg migrations
|
||||
func Migrate(args []string) {
|
||||
db, err := database.DBConn()
|
||||
if err != nil {
|
||||
|
|
@ -33,6 +34,7 @@ func Migrate(args []string) {
|
|||
|
||||
}
|
||||
|
||||
// Reset runs reverts all migrations to version 0 and then applies all migrations to latest
|
||||
func Reset() {
|
||||
db, err := database.DBConn()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue