Adding all migrations
This commit is contained in:
parent
9c6e24765b
commit
ec3af0cad6
@ -1,30 +0,0 @@
|
||||
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
|
||||
|
||||
}
|
35
database/migrations/20181114_181043_company_user.go
Normal file
35
database/migrations/20181114_181043_company_user.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/migration"
|
||||
)
|
||||
|
||||
// DO NOT MODIFY
|
||||
type CompanyUser_20181114_181043 struct {
|
||||
migration.Migration
|
||||
}
|
||||
|
||||
// DO NOT MODIFY
|
||||
func init() {
|
||||
m := &CompanyUser_20181114_181043{}
|
||||
m.Created = "20181114_181043"
|
||||
|
||||
migration.Register("CompanyUser_20181114_181043", m)
|
||||
}
|
||||
|
||||
// Run the migrations
|
||||
func (m *CompanyUser_20181114_181043) Up() {
|
||||
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||
m.SQL("CREATE TABLE public.company_user ( id integer NOT NULL, name text NOT NULL, role smallint NOT NULL, profile jsonb NOT NULL, created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, modified timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL);")
|
||||
m.SQL("CREATE SEQUENCE public.\"companyUser_id_seq\" AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;")
|
||||
m.SQL("ALTER SEQUENCE public.\"companyUser_id_seq\" OWNED BY public.company_user.id;")
|
||||
m.SQL("ALTER TABLE ONLY public.company_user ALTER COLUMN id SET DEFAULT nextval('public.\"companyUser_id_seq\"'::regclass);")
|
||||
m.SQL("ALTER TABLE ONLY public.company_user ADD CONSTRAINT \"companyUser_pkey\" PRIMARY KEY (id);")
|
||||
|
||||
}
|
||||
|
||||
// Reverse the migrations
|
||||
func (m *CompanyUser_20181114_181043) Down() {
|
||||
m.SQL("DROP TABLE public.company_user;")
|
||||
|
||||
}
|
35
database/migrations/20181114_181913_company_data.go
Normal file
35
database/migrations/20181114_181913_company_data.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/migration"
|
||||
)
|
||||
|
||||
// DO NOT MODIFY
|
||||
type CompanyData_20181114_181913 struct {
|
||||
migration.Migration
|
||||
}
|
||||
|
||||
// DO NOT MODIFY
|
||||
func init() {
|
||||
m := &CompanyData_20181114_181913{}
|
||||
m.Created = "20181114_181913"
|
||||
|
||||
migration.Register("CompanyData_20181114_181913", m)
|
||||
}
|
||||
|
||||
// Run the migrations
|
||||
func (m *CompanyData_20181114_181913) Up() {
|
||||
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||
m.SQL("CREATE TABLE public.company_data ( id integer NOT NULL, key text NOT NULL, value text, data jsonb, created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, modified timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL);")
|
||||
m.SQL("CREATE SEQUENCE public.\"companyData_id_seq\" AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;")
|
||||
m.SQL("ALTER SEQUENCE public.\"companyData_id_seq\" OWNED BY public.company_data.id;")
|
||||
m.SQL("ALTER TABLE ONLY public.company_data ALTER COLUMN id SET DEFAULT nextval('public.\"companyData_id_seq\"'::regclass);")
|
||||
m.SQL("ALTER TABLE ONLY public.company_data ADD CONSTRAINT \"companyData_pkey\" PRIMARY KEY (id);")
|
||||
}
|
||||
|
||||
// Reverse the migrations
|
||||
func (m *CompanyData_20181114_181913) Down() {
|
||||
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||
m.SQL("DROP TABLE public.company_data;")
|
||||
|
||||
}
|
35
database/migrations/20181114_181919_post.go
Normal file
35
database/migrations/20181114_181919_post.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/migration"
|
||||
)
|
||||
|
||||
// DO NOT MODIFY
|
||||
type Post_20181114_181919 struct {
|
||||
migration.Migration
|
||||
}
|
||||
|
||||
// DO NOT MODIFY
|
||||
func init() {
|
||||
m := &Post_20181114_181919{}
|
||||
m.Created = "20181114_181919"
|
||||
|
||||
migration.Register("Post_20181114_181919", m)
|
||||
}
|
||||
|
||||
// Run the migrations
|
||||
func (m *Post_20181114_181919) Up() {
|
||||
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||
m.SQL("CREATE TABLE public.post ( id integer NOT NULL, name text, data text NOT NULL, meta jsonb NOT NULL, created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, modified timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL);")
|
||||
m.SQL("CREATE SEQUENCE public.post_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;")
|
||||
m.SQL("ALTER SEQUENCE public.post_id_seq OWNED BY public.post.id;")
|
||||
m.SQL("ALTER TABLE ONLY public.post ALTER COLUMN id SET DEFAULT nextval('public.post_id_seq'::regclass);")
|
||||
m.SQL("ALTER TABLE ONLY public.post ADD CONSTRAINT post_pkey PRIMARY KEY (id);")
|
||||
}
|
||||
|
||||
// Reverse the migrations
|
||||
func (m *Post_20181114_181919) Down() {
|
||||
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||
m.SQL("DROP TABLE public.post;")
|
||||
|
||||
}
|
35
database/migrations/20181114_181923_contact.go
Normal file
35
database/migrations/20181114_181923_contact.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/migration"
|
||||
)
|
||||
|
||||
// DO NOT MODIFY
|
||||
type Contact_20181114_181923 struct {
|
||||
migration.Migration
|
||||
}
|
||||
|
||||
// DO NOT MODIFY
|
||||
func init() {
|
||||
m := &Contact_20181114_181923{}
|
||||
m.Created = "20181114_181923"
|
||||
|
||||
migration.Register("Contact_20181114_181923", m)
|
||||
}
|
||||
|
||||
// Run the migrations
|
||||
func (m *Contact_20181114_181923) Up() {
|
||||
// use m.SQL("CREATE TABLE ...") to make schema update
|
||||
m.SQL("CREATE TABLE public.contact ( id integer NOT NULL, \"firstName\" text, \"lastName\" text NOT NULL, \"phoneNumber\" text, email text, \"lastContact\" date, meta jsonb NOT NULL, created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, modified timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL);")
|
||||
m.SQL("CREATE SEQUENCE public.contact_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;")
|
||||
m.SQL("ALTER SEQUENCE public.contact_id_seq OWNED BY public.contact.id;")
|
||||
m.SQL("ALTER TABLE ONLY public.contact ALTER COLUMN id SET DEFAULT nextval('public.contact_id_seq'::regclass);")
|
||||
m.SQL("ALTER TABLE ONLY public.contact ADD CONSTRAINT contact_pkey PRIMARY KEY (id);")
|
||||
}
|
||||
|
||||
// Reverse the migrations
|
||||
func (m *Contact_20181114_181923) Down() {
|
||||
// use m.SQL("DROP TABLE ...") to reverse schema update
|
||||
m.SQL("DROP TABLE public.contact;")
|
||||
|
||||
}
|
@ -21,10 +21,14 @@ func init() {
|
||||
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);")
|
||||
m.SQL("CREATE SEQUENCE public.system_users_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;")
|
||||
m.SQL("ALTER SEQUENCE public.system_users_id_seq OWNED BY public.user_company_map.id;")
|
||||
m.SQL("ALTER TABLE ONLY public.user_company_map ALTER COLUMN id SET DEFAULT nextval('public.system_users_id_seq'::regclass);")
|
||||
m.SQL("ALTER TABLE ONLY public.user_company_map ADD CONSTRAINT system_users_pkey PRIMARY KEY (id);")
|
||||
}
|
||||
|
||||
// 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;")
|
||||
m.SQL("DROP TABLE user_company_map;")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user