package updates import ( "github.com/go-gormigrate/gormigrate/v2" "gorm.io/gorm" ) // createMenus creates golem15_menu_menus with the PHP columns (v1.0.2 // create_menus_table): a unique code, the active flag (default true) and an // optional CSS class. var createMenus = []*gormigrate.Migration{ { ID: "202610110001_create_golem15_menu_menus", Migrate: func(tx *gorm.DB) error { return tx.Exec(`CREATE TABLE golem15_menu_menus ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL UNIQUE, is_active BOOLEAN NOT NULL DEFAULT true, css_class VARCHAR(255) NULL, created_at TIMESTAMPTZ NULL, updated_at TIMESTAMPTZ NULL )`).Error }, Rollback: func(tx *gorm.DB) error { return tx.Exec(`DROP TABLE IF EXISTS golem15_menu_menus`).Error }, }, } func init() { Register(createMenus...) }