feat(*): 模型计费与渠道目录 - 支持视频 Token 报价结算和稳定模型展示
This commit is contained in:
1 parent
90add8c466
commit
1a79005d25
57 files changed
+2904
-341
No files matched your search
@@ -11,7 +11,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const CurrentSchemaVersion int64 = 23
|
||||
const CurrentSchemaVersion int64 = 26
|
||||
|
||||
const baselineSchemaChecksum = "sha256:open-ai-canvas-schema-v1-20260830"
|
||||
const schemaMigrationAppliedAtIndexChecksum = "sha256:schema-migrations-applied-at-index-v2-20260830"
|
||||
@@ -89,6 +89,34 @@ var schemaMigrations = []migration{
|
||||
{version: 23, name: "canvas_revision_history", checksum: "sha256:canvas-revision-history-v23-20260918", apply: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(&model.CanvasProject{}, &model.CanvasSnapshot{}, &model.CanvasSnapshotResource{})
|
||||
}},
|
||||
{version: 24, name: "channel_model_label", checksum: "sha256:channel-model-label-v24", apply: migrateChannelModelLabel},
|
||||
{version: 25, name: "video_token_formula_snapshot", checksum: "sha256:video-token-formula-snapshot-v25", apply: migrateVideoTokenFormulaSnapshot},
|
||||
{version: 26, name: "channel_model_description", checksum: "sha256:channel-model-description-v26", apply: migrateChannelModelDescription},
|
||||
}
|
||||
|
||||
func migrateChannelModelDescription(tx *gorm.DB) error {
|
||||
if tx.Migrator().HasColumn(&model.ChannelModel{}, "Description") {
|
||||
return nil
|
||||
}
|
||||
return tx.Migrator().AddColumn(&model.ChannelModel{}, "Description")
|
||||
}
|
||||
|
||||
func migrateVideoTokenFormulaSnapshot(tx *gorm.DB) error {
|
||||
for _, field := range []string{"VideoFormulaTokens", "UsageSource"} {
|
||||
if !tx.Migrator().HasColumn(&model.BillingOrder{}, field) {
|
||||
if err := tx.Migrator().AddColumn(&model.BillingOrder{}, field); err != nil {
|
||||
return fmt.Errorf("增加视频 Token 结算字段 %s:%w", field, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func migrateChannelModelLabel(tx *gorm.DB) error {
|
||||
if tx.Migrator().HasColumn(&model.ChannelModel{}, "ChannelLabel") {
|
||||
return nil
|
||||
}
|
||||
return tx.Migrator().AddColumn(&model.ChannelModel{}, "ChannelLabel")
|
||||
}
|
||||
|
||||
func migrateSchemaV14(tx *gorm.DB) error {
|
||||
|
||||
Reference in new issue
Block a user