diff --git a/migrations/mysql/20200721225616_trades.sql b/migrations/mysql/20200721225616_trades.sql index 11ea95dd6..c195494c9 100644 --- a/migrations/mysql/20200721225616_trades.sql +++ b/migrations/mysql/20200721225616_trades.sql @@ -7,12 +7,12 @@ CREATE TABLE `trades` `id` BIGINT UNSIGNED, `order_id` BIGINT UNSIGNED NOT NULL, `exchange` VARCHAR(24) NOT NULL DEFAULT '', - `symbol` VARCHAR(20) NOT NULL, + `symbol` VARCHAR(32) NOT NULL, `price` DECIMAL(16, 8) UNSIGNED NOT NULL, `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `fee` DECIMAL(16, 8) UNSIGNED NOT NULL, - `fee_currency` VARCHAR(10) NOT NULL, + `fee_currency` VARCHAR(16) NOT NULL, `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE, `is_maker` BOOLEAN NOT NULL DEFAULT FALSE, `side` VARCHAR(4) NOT NULL DEFAULT '', diff --git a/migrations/mysql/20201102222546_orders.sql b/migrations/mysql/20201102222546_orders.sql index 51b3edb54..b24de7c14 100644 --- a/migrations/mysql/20201102222546_orders.sql +++ b/migrations/mysql/20201102222546_orders.sql @@ -9,7 +9,7 @@ CREATE TABLE `orders` `order_id` BIGINT UNSIGNED NOT NULL, `client_order_id` VARCHAR(122) NOT NULL DEFAULT '', `order_type` VARCHAR(16) NOT NULL, - `symbol` VARCHAR(20) NOT NULL, + `symbol` VARCHAR(32) NOT NULL, `status` VARCHAR(12) NOT NULL, `time_in_force` VARCHAR(4) NOT NULL, `price` DECIMAL(16, 8) UNSIGNED NOT NULL, diff --git a/migrations/mysql/20220304153317_add_profit_table.sql b/migrations/mysql/20220304153317_add_profit_table.sql index 9a1d44d9d..cb8cf78cd 100644 --- a/migrations/mysql/20220304153317_add_profit_table.sql +++ b/migrations/mysql/20220304153317_add_profit_table.sql @@ -6,7 +6,7 @@ CREATE TABLE `profits` `strategy` VARCHAR(32) NOT NULL, `strategy_instance_id` VARCHAR(64) NOT NULL, - `symbol` VARCHAR(30) NOT NULL, + `symbol` VARCHAR(32) NOT NULL, -- average_cost is the position average cost `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL, @@ -25,7 +25,7 @@ CREATE TABLE `profits` `quote_currency` VARCHAR(10) NOT NULL, - `base_currency` VARCHAR(15) NOT NULL, + `base_currency` VARCHAR(16) NOT NULL, -- ------------------------------------------------------- -- embedded trade data -- @@ -61,7 +61,7 @@ CREATE TABLE `profits` -- fee `fee_in_usd` DECIMAL(16, 8), `fee` DECIMAL(16, 8) NOT NULL, - `fee_currency` VARCHAR(10) NOT NULL, + `fee_currency` VARCHAR(16) NOT NULL, PRIMARY KEY (`gid`), UNIQUE KEY `trade_id` (`trade_id`) diff --git a/migrations/mysql/20220307132917_add_positions.sql b/migrations/mysql/20220307132917_add_positions.sql index 01be64b26..a7757ba1e 100644 --- a/migrations/mysql/20220307132917_add_positions.sql +++ b/migrations/mysql/20220307132917_add_positions.sql @@ -8,7 +8,7 @@ CREATE TABLE `positions` `symbol` VARCHAR(32) NOT NULL, `quote_currency` VARCHAR(10) NOT NULL, - `base_currency` VARCHAR(15) NOT NULL, + `base_currency` VARCHAR(16) NOT NULL, -- average_cost is the position average cost `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL, @@ -19,7 +19,7 @@ CREATE TABLE `positions` -- trade related columns `trade_id` BIGINT UNSIGNED NOT NULL, -- the trade id in the exchange `side` VARCHAR(4) NOT NULL, -- side of the trade - `exchange` VARCHAR(12) NOT NULL, -- exchange of the trade + `exchange` VARCHAR(20) NOT NULL, -- exchange of the trade `traded_at` DATETIME(3) NOT NULL, -- millisecond timestamp PRIMARY KEY (`gid`), diff --git a/migrations/mysql/20220512170322_fix_profit_symbol_length.sql b/migrations/mysql/20220512170322_fix_profit_symbol_length.sql index de2c33797..84b88b059 100644 --- a/migrations/mysql/20220512170322_fix_profit_symbol_length.sql +++ b/migrations/mysql/20220512170322_fix_profit_symbol_length.sql @@ -1,7 +1,6 @@ -- +up -- +begin -ALTER TABLE profits - CHANGE symbol symbol VARCHAR(32) NOT NULL; +ALTER TABLE profits CHANGE symbol symbol VARCHAR(32) NOT NULL; -- +end -- +down diff --git a/migrations/mysql/20240925160534_fix_symbol_length2.sql b/migrations/mysql/20240925160534_fix_symbol_length2.sql new file mode 100644 index 000000000..86fe1481a --- /dev/null +++ b/migrations/mysql/20240925160534_fix_symbol_length2.sql @@ -0,0 +1,26 @@ +-- +up +-- +begin +ALTER TABLE profits MODIFY COLUMN symbol VARCHAR(32) NOT NULL; +-- +end + +-- +begin +ALTER TABLE profits MODIFY COLUMN base_currency VARCHAR(16) NOT NULL; +-- +end + +-- +begin +ALTER TABLE profits MODIFY COLUMN fee_currency VARCHAR(16) NOT NULL; +-- +end + +-- +begin +ALTER TABLE positions MODIFY COLUMN base_currency VARCHAR(16) NOT NULL; +-- +end + +-- +begin +ALTER TABLE positions MODIFY COLUMN symbol VARCHAR(32) NOT NULL; +-- +end + +-- +down + +-- +begin +SELECT 1; +-- +end diff --git a/migrations/sqlite3/20240925160534_fix_symbol_length2.sql b/migrations/sqlite3/20240925160534_fix_symbol_length2.sql new file mode 100644 index 000000000..9f146225e --- /dev/null +++ b/migrations/sqlite3/20240925160534_fix_symbol_length2.sql @@ -0,0 +1,10 @@ +-- +up +-- +begin +SELECT 1; +-- +end + +-- +down + +-- +begin +SELECT 1; +-- +end diff --git a/pkg/migrations/mysql/main_20200721225616_trades.go b/pkg/migrations/mysql/main_20200721225616_trades.go index bc01d80b1..fd8f7a1be 100644 --- a/pkg/migrations/mysql/main_20200721225616_trades.go +++ b/pkg/migrations/mysql/main_20200721225616_trades.go @@ -12,7 +12,7 @@ func init() { func up_main_trades(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { // This code is executed when the migration is applied. - _, err = tx.ExecContext(ctx, "CREATE TABLE `trades`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `id` BIGINT UNSIGNED,\n `order_id` BIGINT UNSIGNED NOT NULL,\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n `symbol` VARCHAR(20) NOT NULL,\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `fee` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `fee_currency` VARCHAR(10) NOT NULL,\n `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_maker` BOOLEAN NOT NULL DEFAULT FALSE,\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `traded_at` DATETIME(3) NOT NULL,\n `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\n `strategy` VARCHAR(32) NULL,\n `pnl` DECIMAL NULL,\n PRIMARY KEY (`gid`),\n UNIQUE KEY `id` (`exchange`, `symbol`, `side`, `id`)\n);") + _, err = tx.ExecContext(ctx, "CREATE TABLE `trades`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `id` BIGINT UNSIGNED,\n `order_id` BIGINT UNSIGNED NOT NULL,\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n `symbol` VARCHAR(32) NOT NULL,\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `fee` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `fee_currency` VARCHAR(16) NOT NULL,\n `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_maker` BOOLEAN NOT NULL DEFAULT FALSE,\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `traded_at` DATETIME(3) NOT NULL,\n `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\n `strategy` VARCHAR(32) NULL,\n `pnl` DECIMAL NULL,\n PRIMARY KEY (`gid`),\n UNIQUE KEY `id` (`exchange`, `symbol`, `side`, `id`)\n);") if err != nil { return err } diff --git a/pkg/migrations/mysql/main_20201102222546_orders.go b/pkg/migrations/mysql/main_20201102222546_orders.go index 0025dabb0..5c2c7285d 100644 --- a/pkg/migrations/mysql/main_20201102222546_orders.go +++ b/pkg/migrations/mysql/main_20201102222546_orders.go @@ -12,7 +12,7 @@ func init() { func up_main_orders(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(122) NOT NULL DEFAULT '',\n `order_type` VARCHAR(16) NOT NULL,\n `symbol` VARCHAR(20) 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 `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\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(32) 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 `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\n PRIMARY KEY (`gid`)\n);") if err != nil { return err } diff --git a/pkg/migrations/mysql/main_20220304153317_add_profit_table.go b/pkg/migrations/mysql/main_20220304153317_add_profit_table.go index 43d1b0bae..fbce03a3e 100644 --- a/pkg/migrations/mysql/main_20220304153317_add_profit_table.go +++ b/pkg/migrations/mysql/main_20220304153317_add_profit_table.go @@ -12,7 +12,7 @@ func init() { func up_main_addProfitTable(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { // This code is executed when the migration is applied. - _, err = tx.ExecContext(ctx, "CREATE TABLE `profits`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `strategy` VARCHAR(32) NOT NULL,\n `strategy_instance_id` VARCHAR(64) NOT NULL,\n `symbol` VARCHAR(8) NOT NULL,\n -- average_cost is the position average cost\n `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- profit is the pnl (profit and loss)\n `profit` DECIMAL(16, 8) NOT NULL,\n -- net_profit is the pnl (profit and loss)\n `net_profit` DECIMAL(16, 8) NOT NULL,\n -- profit_margin is the pnl (profit and loss)\n `profit_margin` DECIMAL(16, 8) NOT NULL,\n -- net_profit_margin is the pnl (profit and loss)\n `net_profit_margin` DECIMAL(16, 8) NOT NULL,\n `quote_currency` VARCHAR(10) NOT NULL,\n `base_currency` VARCHAR(10) NOT NULL,\n -- -------------------------------------------------------\n -- embedded trade data --\n -- -------------------------------------------------------\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n `is_futures` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\n `trade_id` BIGINT UNSIGNED NOT NULL,\n -- side is the side of the trade that makes profit\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_maker` BOOLEAN NOT NULL DEFAULT FALSE,\n -- price is the price of the trade that makes profit\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- quantity is the quantity of the trade that makes profit\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- quote_quantity is the quote quantity of the trade that makes profit\n `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `traded_at` DATETIME(3) NOT NULL,\n -- fee\n `fee_in_usd` DECIMAL(16, 8),\n `fee` DECIMAL(16, 8) NOT NULL,\n `fee_currency` VARCHAR(10) NOT NULL,\n PRIMARY KEY (`gid`),\n UNIQUE KEY `trade_id` (`trade_id`)\n);") + _, err = tx.ExecContext(ctx, "CREATE TABLE `profits`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `strategy` VARCHAR(32) NOT NULL,\n `strategy_instance_id` VARCHAR(64) NOT NULL,\n `symbol` VARCHAR(32) NOT NULL,\n -- average_cost is the position average cost\n `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- profit is the pnl (profit and loss)\n `profit` DECIMAL(16, 8) NOT NULL,\n -- net_profit is the pnl (profit and loss)\n `net_profit` DECIMAL(16, 8) NOT NULL,\n -- profit_margin is the pnl (profit and loss)\n `profit_margin` DECIMAL(16, 8) NOT NULL,\n -- net_profit_margin is the pnl (profit and loss)\n `net_profit_margin` DECIMAL(16, 8) NOT NULL,\n `quote_currency` VARCHAR(10) NOT NULL,\n `base_currency` VARCHAR(16) NOT NULL,\n -- -------------------------------------------------------\n -- embedded trade data --\n -- -------------------------------------------------------\n `exchange` VARCHAR(24) NOT NULL DEFAULT '',\n `is_futures` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_margin` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_isolated` BOOLEAN NOT NULL DEFAULT FALSE,\n `trade_id` BIGINT UNSIGNED NOT NULL,\n -- side is the side of the trade that makes profit\n `side` VARCHAR(4) NOT NULL DEFAULT '',\n `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE,\n `is_maker` BOOLEAN NOT NULL DEFAULT FALSE,\n -- price is the price of the trade that makes profit\n `price` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- quantity is the quantity of the trade that makes profit\n `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n -- quote_quantity is the quote quantity of the trade that makes profit\n `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `traded_at` DATETIME(3) NOT NULL,\n -- fee\n `fee_in_usd` DECIMAL(16, 8),\n `fee` DECIMAL(16, 8) NOT NULL,\n `fee_currency` VARCHAR(16) NOT NULL,\n PRIMARY KEY (`gid`),\n UNIQUE KEY `trade_id` (`trade_id`)\n);") if err != nil { return err } diff --git a/pkg/migrations/mysql/main_20220307132917_add_positions.go b/pkg/migrations/mysql/main_20220307132917_add_positions.go index 51fa78570..11f57689b 100644 --- a/pkg/migrations/mysql/main_20220307132917_add_positions.go +++ b/pkg/migrations/mysql/main_20220307132917_add_positions.go @@ -12,7 +12,7 @@ func init() { func up_main_addPositions(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { // This code is executed when the migration is applied. - _, err = tx.ExecContext(ctx, "CREATE TABLE `positions`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `strategy` VARCHAR(32) NOT NULL,\n `strategy_instance_id` VARCHAR(64) NOT NULL,\n `symbol` VARCHAR(20) NOT NULL,\n `quote_currency` VARCHAR(10) NOT NULL,\n `base_currency` VARCHAR(10) NOT NULL,\n -- average_cost is the position average cost\n `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `base` DECIMAL(16, 8) NOT NULL,\n `quote` DECIMAL(16, 8) NOT NULL,\n `profit` DECIMAL(16, 8) NULL,\n -- trade related columns\n `trade_id` BIGINT UNSIGNED NOT NULL, -- the trade id in the exchange\n `side` VARCHAR(4) NOT NULL, -- side of the trade\n `exchange` VARCHAR(12) NOT NULL, -- exchange of the trade\n `traded_at` DATETIME(3) NOT NULL, -- millisecond timestamp\n PRIMARY KEY (`gid`),\n UNIQUE KEY `trade_id` (`trade_id`, `side`, `exchange`)\n);") + _, err = tx.ExecContext(ctx, "CREATE TABLE `positions`\n(\n `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `strategy` VARCHAR(32) NOT NULL,\n `strategy_instance_id` VARCHAR(64) NOT NULL,\n `symbol` VARCHAR(32) NOT NULL,\n `quote_currency` VARCHAR(10) NOT NULL,\n `base_currency` VARCHAR(16) NOT NULL,\n -- average_cost is the position average cost\n `average_cost` DECIMAL(16, 8) UNSIGNED NOT NULL,\n `base` DECIMAL(16, 8) NOT NULL,\n `quote` DECIMAL(16, 8) NOT NULL,\n `profit` DECIMAL(16, 8) NULL,\n -- trade related columns\n `trade_id` BIGINT UNSIGNED NOT NULL, -- the trade id in the exchange\n `side` VARCHAR(4) NOT NULL, -- side of the trade\n `exchange` VARCHAR(20) NOT NULL, -- exchange of the trade\n `traded_at` DATETIME(3) NOT NULL, -- millisecond timestamp\n PRIMARY KEY (`gid`),\n UNIQUE KEY `trade_id` (`trade_id`, `side`, `exchange`)\n);") if err != nil { return err } diff --git a/pkg/migrations/mysql/main_20220512170322_fix_profit_symbol_length.go b/pkg/migrations/mysql/main_20220512170322_fix_profit_symbol_length.go index 90166fe7d..738509ec8 100644 --- a/pkg/migrations/mysql/main_20220512170322_fix_profit_symbol_length.go +++ b/pkg/migrations/mysql/main_20220512170322_fix_profit_symbol_length.go @@ -12,7 +12,7 @@ func init() { func up_main_fixProfitSymbolLength(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { // This code is executed when the migration is applied. - _, err = tx.ExecContext(ctx, "ALTER TABLE profits\n CHANGE symbol symbol VARCHAR(20) NOT NULL;") + _, err = tx.ExecContext(ctx, "ALTER TABLE profits CHANGE symbol symbol VARCHAR(32) NOT NULL;") if err != nil { return err } diff --git a/pkg/migrations/mysql/main_20240925160534_fix_symbol_length2.go b/pkg/migrations/mysql/main_20240925160534_fix_symbol_length2.go new file mode 100644 index 000000000..2288d74ea --- /dev/null +++ b/pkg/migrations/mysql/main_20240925160534_fix_symbol_length2.go @@ -0,0 +1,45 @@ +package mysql + +import ( + "context" + + "github.com/c9s/rockhopper/v2" +) + +func init() { + AddMigration("main", up_main_fixSymbolLength2, down_main_fixSymbolLength2) +} + +func up_main_fixSymbolLength2(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { + // This code is executed when the migration is applied. + _, err = tx.ExecContext(ctx, "ALTER TABLE profits MODIFY COLUMN symbol VARCHAR(32) NOT NULL;") + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, "ALTER TABLE profits MODIFY COLUMN base_currency VARCHAR(16) NOT NULL;") + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, "ALTER TABLE profits MODIFY COLUMN fee_currency VARCHAR(16) NOT NULL;") + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, "ALTER TABLE positions MODIFY COLUMN base_currency VARCHAR(16) NOT NULL;") + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, "ALTER TABLE positions MODIFY COLUMN symbol VARCHAR(32) NOT NULL;") + if err != nil { + return err + } + return err +} + +func down_main_fixSymbolLength2(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { + // This code is executed when the migration is rolled back. + _, err = tx.ExecContext(ctx, "SELECT 1;") + if err != nil { + return err + } + return err +} diff --git a/pkg/migrations/sqlite3/main_20240925160534_fix_symbol_length2.go b/pkg/migrations/sqlite3/main_20240925160534_fix_symbol_length2.go new file mode 100644 index 000000000..a2c89f340 --- /dev/null +++ b/pkg/migrations/sqlite3/main_20240925160534_fix_symbol_length2.go @@ -0,0 +1,29 @@ +package sqlite3 + +import ( + "context" + + "github.com/c9s/rockhopper/v2" +) + +func init() { + AddMigration("main", up_main_fixSymbolLength2, down_main_fixSymbolLength2) +} + +func up_main_fixSymbolLength2(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { + // This code is executed when the migration is applied. + _, err = tx.ExecContext(ctx, "SELECT 1;") + if err != nil { + return err + } + return err +} + +func down_main_fixSymbolLength2(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { + // This code is executed when the migration is rolled back. + _, err = tx.ExecContext(ctx, "SELECT 1;") + if err != nil { + return err + } + return err +}