Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: invalid migration when changing column default value #4988

Closed
beerose opened this issue Jun 4, 2020 · 1 comment · Fixed by #4790
Closed

console: invalid migration when changing column default value #4988

beerose opened this issue Jun 4, 2020 · 1 comment · Fixed by #4790
Labels
c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working

Comments

@beerose
Copy link
Contributor

beerose commented Jun 4, 2020

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
@beerose beerose added c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working labels Jun 4, 2020
@soorajshankar
Copy link
Member

this should be again
sql: ALTER TABLE ONLY "public"."user" ALTER COLUMN "info" SET DEFAULT 'some info';
right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants