multitenantStack/database/migrations/20181114_181043_company_user.go

36 lines
1.2 KiB
Go

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;")
}