@@ -76,10 +76,10 @@ type Migration009_listing_listing_metadata struct {
76
76
}
77
77
78
78
var (
79
- Migration009CreateCasesTable = "create table cases (caseID text primary key not null, buyerContract blob, vendorContract blob, buyerValidationErrors blob, vendorValidationErrors blob, buyerPayoutAddress text, vendorPayoutAddress text, buyerOutpoints blob, vendorOutpoints blob, state integer, read integer, timestamp integer, buyerOpened integer, claim text, disputeResolution blob, lastDisputeExpiryNotifiedAt integer not null default 0);"
80
- Migration009CreateSalesTable = "create table sales (orderID text primary key not null, contract blob, state integer, read integer, timestamp integer, total integer, thumbnail text, buyerID text, buyerHandle text, title text, shippingName text, shippingAddress text, paymentAddr text, funded integer, transactions blob, needsSync integer, lastDisputeTimeoutNotifiedAt integer not null default 0);"
81
- Migration009CreateSalesIndex = "create index index_sales on sales (paymentAddr, timestamp);"
82
- Migration009CreatePurchasesTable = "create table purchases (orderID text primary key not null, contract blob, state integer, read integer, timestamp integer, total integer, thumbnail text, vendorID text, vendorHandle text, title text, shippingName text, shippingAddress text, paymentAddr text, funded integer, transactions blob, lastDisputeTimeoutNotifiedAt integer not null default 0, lastDisputeExpiryNotifiedAt integer not null default 0, disputedAt integer not null default 0);"
79
+ Migration009CreatePreviousCasesTable = "create table cases (caseID text primary key not null, buyerContract blob, vendorContract blob, buyerValidationErrors blob, vendorValidationErrors blob, buyerPayoutAddress text, vendorPayoutAddress text, buyerOutpoints blob, vendorOutpoints blob, state integer, read integer, timestamp integer, buyerOpened integer, claim text, disputeResolution blob, lastDisputeExpiryNotifiedAt integer not null default 0);"
80
+ Migration009CreatePreviousSalesTable = "create table sales (orderID text primary key not null, contract blob, state integer, read integer, timestamp integer, total integer, thumbnail text, buyerID text, buyerHandle text, title text, shippingName text, shippingAddress text, paymentAddr text, funded integer, transactions blob, needsSync integer, lastDisputeTimeoutNotifiedAt integer not null default 0);"
81
+ Migration009CreatePreviousSalesIndex = "create index index_sales on sales (paymentAddr, timestamp);"
82
+ Migration009CreatePreviousPurchasesTable = "create table purchases (orderID text primary key not null, contract blob, state integer, read integer, timestamp integer, total integer, thumbnail text, vendorID text, vendorHandle text, title text, shippingName text, shippingAddress text, paymentAddr text, funded integer, transactions blob, lastDisputeTimeoutNotifiedAt integer not null default 0, lastDisputeExpiryNotifiedAt integer not null default 0, disputedAt integer not null default 0);"
83
83
)
84
84
85
85
func (Migration009 ) Up (repoPath string , dbPassword string , testnet bool ) (err error ) {
@@ -149,18 +149,18 @@ func (Migration009) Down(repoPath string, dbPassword string, testnet bool) error
149
149
err = withTransaction (db , func (tx * sql.Tx ) error {
150
150
for _ , stmt := range []string {
151
151
"ALTER TABLE cases RENAME TO temp_cases;" ,
152
- Migration009CreateCasesTable ,
152
+ Migration009CreatePreviousCasesTable ,
153
153
"INSERT INTO cases SELECT caseID, buyerContract, vendorContract, buyerValidationErrors, vendorValidationErrors, buyerPayoutAddress, vendorPayoutAddress, buyerOutpoints, vendorOutpoints, state, read, timestamp, buyerOpened, claim, disputeResolution, lastDisputeExpiryNotifiedAt FROM temp_cases;" ,
154
154
"DROP TABLE temp_cases;" ,
155
155
156
156
"ALTER TABLE sales RENAME TO temp_sales;" ,
157
- Migration009CreateSalesTable ,
158
- Migration009CreateSalesIndex ,
157
+ Migration009CreatePreviousSalesTable ,
158
+ Migration009CreatePreviousSalesIndex ,
159
159
"INSERT INTO sales SELECT orderID, contract, state, read, timestamp, total, thumbnail, buyerID, buyerHandle, title, shippingName, shippingAddress, paymentAddr, funded, transactions, needsSync, lastDisputeTimeoutNotifiedAt FROM temp_sales;" ,
160
160
"DROP TABLE temp_sales;" ,
161
161
162
162
"ALTER TABLE purchases RENAME TO temp_purchases;" ,
163
- Migration009CreatePurchasesTable ,
163
+ Migration009CreatePreviousPurchasesTable ,
164
164
"INSERT INTO purchases SELECT orderID, contract, state, read, timestamp, total, thumbnail, vendorID, vendorHandle, title, shippingName, shippingAddress, paymentAddr, funded, transactions, lastDisputeTimeoutNotifiedAt, lastDisputeExpiryNotifiedAt, disputedAt FROM temp_purchases;" ,
165
165
"DROP TABLE temp_purchases;" ,
166
166
} {
0 commit comments