Code Monkey home page Code Monkey logo

Comments (3)

cbautista1002 avatar cbautista1002 commented on May 20, 2024 3

Here are the tracebacks in case thats helpful:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/router.py", line 152, in run_one
    migrator.run()
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/migrator.py", line 129, in run
    op.run()
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 160, in run
    self._handle_result(method(*self.args, **kwargs))
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 154, in _handle_result
    self._handle_result(item)
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 149, in _handle_result
    self.execute(result)
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 145, in execute
    self.migrator.database.execute(node)
  File "/usr/local/lib/python3.6/site-packages/playhouse/postgres_ext.py", line 464, in execute
    cursor = self.execute_sql(sql, params, commit=commit)
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 2876, in execute_sql
    cursor.execute(sql, params or ())
psycopg2.errors.SyntaxError: syntax error at or near "VARCHAR"
LINE 1: ALTER TABLE "pgtest2" ALTER COLUMN "name" VARCHAR(123) TYPE ...
                                                  ^

Traceback (most recent call last):
  File "/usr/local/bin/pw_migrate", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/cli.py", line 63, in migrate
    migrations = router.run(name, fake=fake)
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/router.py", line 180, in run
    self.run_one(mname, migrator, fake=fake, force=fake)
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/router.py", line 152, in run_one
    migrator.run()
  File "/usr/local/lib/python3.6/site-packages/peewee_migrate/migrator.py", line 129, in run
    op.run()
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 160, in run
    self._handle_result(method(*self.args, **kwargs))
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 154, in _handle_result
    self._handle_result(item)
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 149, in _handle_result
    self.execute(result)
  File "/usr/local/lib/python3.6/site-packages/playhouse/migrate.py", line 145, in execute
    self.migrator.database.execute(node)
  File "/usr/local/lib/python3.6/site-packages/playhouse/postgres_ext.py", line 464, in execute
    cursor = self.execute_sql(sql, params, commit=commit)
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 2876, in execute_sql
    cursor.execute(sql, params or ())
psycopg2.errors.SyntaxError: syntax error at or near "VARCHAR"
LINE 1: ALTER TABLE "pgtest2" ALTER COLUMN "name" VARCHAR(123) TYPE ...
                                                  ^

from peewee_migrate.

Tatoo988 avatar Tatoo988 commented on May 20, 2024 1

The SQL that is being created is:
"ALTER TABLE "table_name" ALTER COLUMN "table_column" NUMERIC(24, 12) TYPE DEFAULT 0"

The word TYPE is being attached in the wrong place. (see this part of the code for Postgres.)
The DEFAULT clause shouldn't be included in the context._sql. I've made a (really ugly) workaround that removes the space and the DEFAULT clause and I could successfully apply the migrations

from peewee_migrate.

pasinter avatar pasinter commented on May 20, 2024 1

I can still reproduce this issue with peewee-migrate==1.1.6

from peewee_migrate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.