Files
summercms/docs/examples/blog/updates/20260101000100_add_published_at.go
Jakub Zych 70e4b4183c feat(build): mark scaffolded files with //summer:make and pass the app to generated commands (quick-261028-pq8)
- model, migration, command, job and admin-controller stubs start with
  //summer:make <kind>; registry.gen.go keeps its generated-code header
- the registry scan accepts the directive and the older header
- command functions may take one *backpack.App; generatedCommands takes a
  variadic app, so plugin.go files calling generatedCommands() still compile
- scaffolded plugins keep the app from Boot and return generatedCommands(p.app)
- make:command notes the nil app for an older plugin.go
- docs, help text and the blog example follow
2026-10-28 19:04:39 +01:00

22 lines
586 B
Go

//summer:make migration
package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// AddPublishedAt returns the 20260101000100_add_published_at gormigrate entry.
func AddPublishedAt() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "20260101000100_add_published_at",
Migrate: func(tx *gorm.DB) error {
return tx.Exec("ALTER TABLE acme_blog_posts ADD COLUMN published_at TIMESTAMPTZ NULL").Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec("ALTER TABLE acme_blog_posts DROP COLUMN IF EXISTS published_at").Error
},
}
}