From 8bb702223aef9b6b9f80767882bca6b61c32f557 Mon Sep 17 00:00:00 2001 From: TonyQ Date: Sat, 11 Dec 2021 02:23:39 +0800 Subject: [PATCH] orders: update client_order_id (client_id) column length for #338 --- migrations/mysql/20201102222546_orders.sql | 2 +- pkg/migrations/mysql/20201102222546_orders.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migrations/mysql/20201102222546_orders.sql b/migrations/mysql/20201102222546_orders.sql index ec5eb0e11..297173908 100644 --- a/migrations/mysql/20201102222546_orders.sql +++ b/migrations/mysql/20201102222546_orders.sql @@ -6,7 +6,7 @@ CREATE TABLE `orders` `exchange` VARCHAR(24) NOT NULL DEFAULT '', -- order_id is the order id returned from the exchange `order_id` BIGINT UNSIGNED NOT NULL, - `client_order_id` VARCHAR(42) NOT NULL DEFAULT '', + `client_order_id` VARCHAR(122) NOT NULL DEFAULT '', `order_type` VARCHAR(16) NOT NULL, `symbol` VARCHAR(8) NOT NULL, `status` VARCHAR(12) NOT NULL, diff --git a/pkg/migrations/mysql/20201102222546_orders.go b/pkg/migrations/mysql/20201102222546_orders.go index f5bf0734a..5f4215052 100644 --- a/pkg/migrations/mysql/20201102222546_orders.go +++ b/pkg/migrations/mysql/20201102222546_orders.go @@ -14,7 +14,7 @@ func init() { func upOrders(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { // This code is executed when the migration is applied. - _, err = tx.ExecContext(ctx, "CREATE TABLE `orders`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n -- order_id is the order id returned from the exchange\n `order_id` BIGINT UNSIGNED NOT NULL,\n `client_order_id` VARCHAR(42) NOT NULL DEFAULT '',\n `order_type` VARCHAR(16) NOT NULL,\n `symbol` VARCHAR(8) NOT NULL,\n `status` VARCHAR(12) NOT NULL,\n `time_in_force` VARCHAR(4) NOT NULL,\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `stop_price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `executed_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0,\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `is_working` BOOL NOT NULL DEFAULT FALSE,\n `created_at` DATETIME(3) NOT NULL,\n `updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),\n PRIMARY KEY (`gid`)\n);") + _, err = tx.ExecContext(ctx, "CREATE TABLE `orders`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n -- order_id is the order id returned from the exchange\n `order_id` BIGINT UNSIGNED NOT NULL,\n `client_order_id` VARCHAR(122) NOT NULL DEFAULT '',\n `order_type` VARCHAR(16) NOT NULL,\n `symbol` VARCHAR(8) NOT NULL,\n `status` VARCHAR(12) NOT NULL,\n `time_in_force` VARCHAR(4) NOT NULL,\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `stop_price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `executed_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0,\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `is_working` BOOL NOT NULL DEFAULT FALSE,\n `created_at` DATETIME(3) NOT NULL,\n `updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),\n PRIMARY KEY (`gid`)\n);") if err != nil { return err }