Adding migrations
This commit is contained in:
parent
4c3dec838e
commit
cbdb6dc339
30
database/migrations/20181112_131638_testMig.go
Normal file
30
database/migrations/20181112_131638_testMig.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/astaxie/beego/migration"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
type TestMig_20181112_131638 struct {
|
||||||
|
migration.Migration
|
||||||
|
}
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
func init() {
|
||||||
|
m := &TestMig_20181112_131638{}
|
||||||
|
m.Created = "20181112_131638"
|
||||||
|
|
||||||
|
migration.Register("TestMig_20181112_131638", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the migrations
|
||||||
|
func (m *TestMig_20181112_131638) Up() {
|
||||||
|
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the migrations
|
||||||
|
func (m *TestMig_20181112_131638) Down() {
|
||||||
|
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||||
|
|
||||||
|
}
|
30
database/systemmigrations/20181108_133717_initial_schema.go
Normal file
30
database/systemmigrations/20181108_133717_initial_schema.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/astaxie/beego/migration"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
type InitialSchema_20181108_133717 struct {
|
||||||
|
migration.Migration
|
||||||
|
}
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
func init() {
|
||||||
|
m := &InitialSchema_20181108_133717{}
|
||||||
|
m.Created = "20181108_133717"
|
||||||
|
|
||||||
|
migration.Register("InitialSchema_20181108_133717", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the migrations
|
||||||
|
func (m *InitialSchema_20181108_133717) Up() {
|
||||||
|
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||||
|
m.SQL("CREATE TABLE public.user_company_map (id integer NOT NULL,email text NOT NULL,password_hash text NOT NULL,company text NOT NULL,company_user_id bigint NOT NULL,created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,modified timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL);")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the migrations
|
||||||
|
func (m *InitialSchema_20181108_133717) Down() {
|
||||||
|
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||||
|
m.SQL("DROP TABLE uer_company_map;")
|
||||||
|
}
|
30
database/systemmigrations/20181112_134051_CreateTemplate.go
Normal file
30
database/systemmigrations/20181112_134051_CreateTemplate.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/astaxie/beego/migration"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
type CreateTemplate_20181112_134051 struct {
|
||||||
|
migration.Migration
|
||||||
|
}
|
||||||
|
|
||||||
|
// DO NOT MODIFY
|
||||||
|
func init() {
|
||||||
|
m := &CreateTemplate_20181112_134051{}
|
||||||
|
m.Created = "20181112_134051"
|
||||||
|
|
||||||
|
migration.Register("CreateTemplate_20181112_134051", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the migrations
|
||||||
|
func (m *CreateTemplate_20181112_134051) Up() {
|
||||||
|
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||||
|
m.SQL("CREATE DATABASE company_template;")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the migrations
|
||||||
|
func (m *CreateTemplate_20181112_134051) Down() {
|
||||||
|
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||||
|
m.SQL("DROP DATABASE company_template;")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user