Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 1889050

Browse files
committed
TWEAK: Update migration9 schema sql stmt names to reflect that they're for the previous version.
1 parent 427b9d2 commit 1889050

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

repo/migrations/Migration009.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ type Migration009_listing_listing_metadata struct {
7676
}
7777

7878
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);"
8383
)
8484

8585
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
149149
err = withTransaction(db, func(tx *sql.Tx) error {
150150
for _, stmt := range []string{
151151
"ALTER TABLE cases RENAME TO temp_cases;",
152-
Migration009CreateCasesTable,
152+
Migration009CreatePreviousCasesTable,
153153
"INSERT INTO cases SELECT caseID, buyerContract, vendorContract, buyerValidationErrors, vendorValidationErrors, buyerPayoutAddress, vendorPayoutAddress, buyerOutpoints, vendorOutpoints, state, read, timestamp, buyerOpened, claim, disputeResolution, lastDisputeExpiryNotifiedAt FROM temp_cases;",
154154
"DROP TABLE temp_cases;",
155155

156156
"ALTER TABLE sales RENAME TO temp_sales;",
157-
Migration009CreateSalesTable,
158-
Migration009CreateSalesIndex,
157+
Migration009CreatePreviousSalesTable,
158+
Migration009CreatePreviousSalesIndex,
159159
"INSERT INTO sales SELECT orderID, contract, state, read, timestamp, total, thumbnail, buyerID, buyerHandle, title, shippingName, shippingAddress, paymentAddr, funded, transactions, needsSync, lastDisputeTimeoutNotifiedAt FROM temp_sales;",
160160
"DROP TABLE temp_sales;",
161161

162162
"ALTER TABLE purchases RENAME TO temp_purchases;",
163-
Migration009CreatePurchasesTable,
163+
Migration009CreatePreviousPurchasesTable,
164164
"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;",
165165
"DROP TABLE temp_purchases;",
166166
} {

repo/migrations/Migration009_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ var (
2020
"DROP TABLE IF EXISTS cases;",
2121
"DROP TABLE IF EXISTS sales;",
2222
"DROP TABLE IF EXISTS purchases;",
23-
migrations.Migration009CreateCasesTable,
24-
migrations.Migration009CreateSalesTable,
25-
migrations.Migration009CreatePurchasesTable,
23+
migrations.Migration009CreatePreviousCasesTable,
24+
migrations.Migration009CreatePreviousSalesTable,
25+
migrations.Migration009CreatePreviousPurchasesTable,
2626
}
2727

2828
testMigration009FixtureStmts = []string{

0 commit comments

Comments
 (0)