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

View File

@ -14,7 +14,7 @@ func init() {
func upFixProfitSymbolLength(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, "SELECT 1;")
if err != nil {
return err
}