Files
sm-user-plugin/updates/202610040001_add_users_permissions.go
Jakub Zych e22f7660f3 feat: add the admin columns and the frontend permissions table
- users.permissions and users.last_seen as additive columns
- golem15_user_frontend_permissions (code, label, tab, comment)
- User gains LastSeen, read-only CreatedAt and UpdatedAt and the
  filterByGroup list scope; none of them is serialized
- migration tests roll back by position past the three new steps
2026-10-05 12:51:41 +02:00

26 lines
703 B
Go

package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// The users.permissions column of PHP updates/v1.0.1/create_users_table.php:
// the user's own frontend permissions as a JSON object of code to 1 or -1,
// NULL or an empty string when the user has none.
var usersPermissionsMigrations = []*gormigrate.Migration{
{
ID: "202610040001_add_users_permissions",
Migrate: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE users ADD COLUMN permissions TEXT NULL`).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE users DROP COLUMN IF EXISTS permissions`).Error
},
},
}
func init() {
Register(usersPermissionsMigrations...)
}