这是indexloc提供的服务,不要输入任何密码
Skip to content

console: invalid migration when changing column default value #4988

@beerose

Description

@beerose

Steps to reproduce:

  1. Crate table.
  2. Set default for a column.
    Generated migrations will be okay at this point:
up
- args:
  cascade: false
  read_only: false
  sql: ALTER TABLE ONLY "public"."user" ALTER COLUMN "info" SET DEFAULT 'some info';
type: run_sql

down
- args:
  cascade: false
  read_only: false
  sql: ALTER TABLE ONLY "public"."user" ALTER COLUMN "info" DROP DEFAULT;
type: run_sql
  1. Change the default value.
    Up migration will be correct:
- args:
    cascade: false
    read_only: false
    sql: ALTER TABLE ONLY "public"."user" ALTER COLUMN "info" SET DEFAULT 'new info';
  type: run_sql

But the down migration would have the incorrect syntax (''some info'::text' part):

- args:
    cascade: false
    read_only: false
    sql: ALTER TABLE ONLY "public"."user" ALTER COLUMN "info" SET DEFAULT ''some info'::text';
  type: run_sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    c/consoleRelated to consolee/quickfixcan be wrapped up in few hoursk/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions