fix sqlite column modification

This commit is contained in:
Raphanus Lo 2022-05-13 10:20:47 +08:00
parent 075028f8fc
commit e968688e7f
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,8 @@
-- +up -- +up
-- +begin -- +begin
ALTER TABLE profits -- We can not change column type in sqlite
CHANGE symbol symbol VARCHAR(20) NOT NULL; -- However, SQLite does not enforce the length of a VARCHAR, i.e VARCHAR(8) == VARCHAR(20) == TEXT
SELECT 1;
-- +end -- +end
-- +down -- +down

View File

@ -14,7 +14,7 @@ func init() {
func upFixProfitSymbolLength(ctx context.Context, tx rockhopper.SQLExecutor) (err error) { func upFixProfitSymbolLength(ctx context.Context, tx rockhopper.SQLExecutor) (err error) {
// This code is executed when the migration is applied. // 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, "SELECT 1;")
if err != nil { if err != nil {
return err return err
} }