multitenantStack/database/migrations/20181114_181913_company_data.go

36 lines
1.3 KiB
Go

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, \"modifiedBy\" 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.\"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;")
}