Files
sm-menu-plugin/updates/202610110001_create_golem15_menu_menus.go
Jakub Zych 08f99b8aad feat(17-04): menu plugin admin with registry types, URL checks and tree reorder
- golem15.menu plugin, tables golem15_menu_menus and golem15_menu_menu_entries with the PHP columns plus a nullable url_pattern (D-02)
- MenuEntry BeforeSave ports PHP beforeSave: nest columns 0, menu from the parent, sort_order after the menu's last
- entry type dropdown: url, divider and the signpost registry types; reference depends on type through signpost.ReferenceOptions
- URL scheme allowlist (errors.url_scheme), target _self or _blank, menu and parent cycle checks
- menu filter, toolbar reorder/create/delete and config_reorder.yaml partitioned by menu
- navigation Menus with Menus and Menu entries, permission golem15.menu.manage_menu, en and pl phrasebooks
- TestMenuAdminSmoke
2026-10-12 17:30:50 +02:00

34 lines
836 B
Go

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...)
}