Update Price model and migration to use unsigned integer for channel_type

This commit is contained in:
wood chen 2025-02-23 03:42:38 +08:00
parent a2932ecf6b
commit c9a9e7b845
2 changed files with 5 additions and 5 deletions

View File

@ -187,7 +187,7 @@ func migratePrices(sqliteDB *sql.DB, mysqlDB *sql.DB) error {
model string
modelType string
billingType string
channelType string
channelType uint
currency string
inputPrice float64
outputPrice float64
@ -199,7 +199,7 @@ func migratePrices(sqliteDB *sql.DB, mysqlDB *sql.DB) error {
tempModel sql.NullString
tempModelType sql.NullString
tempBillingType sql.NullString
tempChannelType sql.NullString
tempChannelType sql.NullInt64
tempCurrency sql.NullString
tempInputPrice sql.NullFloat64
tempOutputPrice sql.NullFloat64
@ -226,7 +226,7 @@ func migratePrices(sqliteDB *sql.DB, mysqlDB *sql.DB) error {
`,
id, model, modelType, billingType, channelType, currency,
inputPrice, outputPrice, priceSource, status, createdAt, updatedAt,
createdBy, tempModel.String, tempModelType.String, tempBillingType.String, tempChannelType.String,
createdBy, tempModel.String, tempModelType.String, tempBillingType.String, tempChannelType.Int64,
tempCurrency.String, tempInputPrice.Float64, tempOutputPrice.Float64, tempPriceSource.String, updatedBy.String,
)
if err != nil {

View File

@ -38,7 +38,7 @@ func CreatePriceTableSQL() string {
model VARCHAR(255) NOT NULL,
model_type VARCHAR(50) NOT NULL,
billing_type VARCHAR(50) NOT NULL,
channel_type VARCHAR(50) NOT NULL,
channel_type BIGINT UNSIGNED NOT NULL,
currency VARCHAR(10) NOT NULL,
input_price DECIMAL(10,6) NOT NULL,
output_price DECIMAL(10,6) NOT NULL,
@ -50,7 +50,7 @@ func CreatePriceTableSQL() string {
temp_model VARCHAR(255),
temp_model_type VARCHAR(50),
temp_billing_type VARCHAR(50),
temp_channel_type VARCHAR(50),
temp_channel_type BIGINT UNSIGNED,
temp_currency VARCHAR(10),
temp_input_price DECIMAL(10,6),
temp_output_price DECIMAL(10,6),