Squash the remaining golem15_journal_* tables plus the backend_users author slug so a host migrate matches the frozen PHP schema. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package updates
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var createSettings = []*gormigrate.Migration{
|
|
{
|
|
ID: "202610060006_create_golem15_journal_settings",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
for _, stmt := range []string{
|
|
`CREATE TABLE golem15_journal_settings (
|
|
id INTEGER PRIMARY KEY,
|
|
show_all_posts BOOLEAN NOT NULL DEFAULT TRUE,
|
|
use_rich_editor BOOLEAN NOT NULL DEFAULT FALSE,
|
|
search_use_typesense BOOLEAN NOT NULL DEFAULT FALSE,
|
|
search_title_weight INTEGER NOT NULL DEFAULT 5,
|
|
search_excerpt_weight INTEGER NOT NULL DEFAULT 3,
|
|
search_content_weight INTEGER NOT NULL DEFAULT 1,
|
|
rss_enabled BOOLEAN NOT NULL DEFAULT TRUE,
|
|
rss_include_content BOOLEAN NOT NULL DEFAULT FALSE,
|
|
rss_title TEXT NULL,
|
|
rss_description TEXT NULL,
|
|
rss_language TEXT NOT NULL DEFAULT 'en-us',
|
|
rss_copyright TEXT NULL,
|
|
rss_image_url TEXT NULL,
|
|
rss_posts_per_feed INTEGER NOT NULL DEFAULT 20
|
|
)`,
|
|
`INSERT INTO golem15_journal_settings (id) VALUES (1)`,
|
|
} {
|
|
if err := tx.Exec(stmt).Error; err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec(`DROP TABLE IF EXISTS golem15_journal_settings`).Error
|
|
},
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
Register(createSettings...)
|
|
}
|