feat(05-03): add user-plugin organisations table (structure only)

- create_organisations folds PHP v3.2.0; no users-table ALTER this phase
- Organisation model is an FK target; app.key placeholder in config
This commit is contained in:
Jakub Zych
2026-09-18 19:37:41 +02:00
parent 2d4245681e
commit 8d1248c328
6 changed files with 485 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// Folds PHP updates/v3.2.0/create_organisations_table.php.
//
// Phase 5 does not ALTER the users table — deferred to Phase 7's AUTH-02 per
// 05-CONTEXT.md user-confirmed decision; this migration only creates the FK
// target golem15_user_organisations table that Fonoteka's org credential
// tables reference.
var organisationsMigrations = []*gormigrate.Migration{
{
ID: "202609180002_create_organisations",
Migrate: func(tx *gorm.DB) error {
return tx.Exec(`
CREATE TABLE golem15_user_organisations (
id SERIAL PRIMARY KEY,
slug TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
description TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
)`).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec("DROP TABLE IF EXISTS golem15_user_organisations").Error
},
},
}
func init() {
Register(organisationsMigrations...)
}