- 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
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package updates
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// PHP updates/v2.8.0/create_frontend_permissions_table.php: the catalogue of
|
|
// frontend permissions the user and group permission editors offer. Rows
|
|
// come from migrations or seeds of the host application.
|
|
var frontendPermissionsMigrations = []*gormigrate.Migration{
|
|
{
|
|
ID: "202610040003_create_frontend_permissions",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
return execStmts(tx, []string{
|
|
`CREATE TABLE golem15_user_frontend_permissions (
|
|
id SERIAL PRIMARY KEY,
|
|
code VARCHAR(255) NOT NULL,
|
|
label VARCHAR(255) NOT NULL,
|
|
tab VARCHAR(255) NOT NULL,
|
|
comment VARCHAR(255) NULL,
|
|
created_at TIMESTAMPTZ NULL,
|
|
updated_at TIMESTAMPTZ NULL
|
|
)`,
|
|
`CREATE UNIQUE INDEX golem15_user_frontend_permissions_code_unique ON golem15_user_frontend_permissions (code)`,
|
|
})
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec(`DROP TABLE IF EXISTS golem15_user_frontend_permissions`).Error
|
|
},
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
Register(frontendPermissionsMigrations...)
|
|
}
|