package migrate_record

import (
	"github.com/pingcap/dbaas/billing2/db/entity"
	"gorm.io/gorm"
)

// 2026-06-29-billing-snapshot
//
// Consolidated record for the billing-snapshot feature. This replaces the
// three records that were previously added in this feature branch:
//
//   - 2026-05-31-billing-snapshot-m1 (InputBundle / Run / SettlementFact /
//     ActiveRun / InvoiceLink)
//   - 2026-06-28-billing-snapshot-apply-record (ApplyRecord)
//   - 2026-06-29-billing-snapshot-settlement-fact-usage (SettlementFact)
//
// They AutoMigrate the same six entities and were folded into one before
// the branch merges back into main, so the feature arrives as a single
// unit. AutoMigrate is idempotent, so a warm DB that already applied some
// or all of the three older records converges on the same schema.
var _ = AddMigrateRecord(
	"2026-06-29-billing-snapshot",
	func(db *gorm.DB) error {
		return db.AutoMigrate(
			&entity.BillingSnapshotInputBundle{},
			&entity.BillingSnapshotRun{},
			&entity.BillingSnapshotSettlementFact{},
			&entity.BillingSnapshotActiveRun{},
			&entity.BillingSnapshotInvoiceLink{},
			&entity.BillingSnapshotApplyRecord{},
		)
	},
)