Skip to content

Instantly share code, notes, and snippets.

@cerivera
Created August 25, 2014 19:21
Show Gist options
  • Save cerivera/bf567dedd80a46050c08 to your computer and use it in GitHub Desktop.
Save cerivera/bf567dedd80a46050c08 to your computer and use it in GitHub Desktop.
Failed upgrade with existing Alembic
INFO [alembic.migration] Context impl PostgresqlImpl.
INFO [alembic.migration] Will assume transactional DDL.
INFO [alembic.migration] Running upgrade None -> 1d8e4022d63b
Traceback (most recent call last):
File "/usr/local/bin/alembic", line 9, in <module>
load_entry_point('alembic==0.3.7dev', 'console_scripts', 'alembic')()
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/config.py", line 229, in main
**dict((k, getattr(options, k)) for k in kwarg)
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/command.py", line 121, in upgrade
script.run_env()
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/script.py", line 192, in run_env
util.load_python_file(self.dir, 'env.py')
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/util.py", line 185, in load_python_file
module = imp.load_source(module_id, path, open(path, 'rb'))
File "alembic/env.py", line 79, in <module>
run_migrations_online()
File "alembic/env.py", line 72, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/environment.py", line 467, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/migration.py", line 211, in run_migrations
change(**kw)
File "alembic/versions/1d8e4022d63b_new_table.py", line 24, in upgrade
sa.PrimaryKeyConstraint('id')
File "<string>", line 7, in create_table
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/operations.py", line 534, in create_table
self._table(name, *columns, **kw)
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/ddl/impl.py", line 148, in create_table
self._exec(schema.CreateTable(table))
File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.7dev-py2.7.egg/alembic/ddl/impl.py", line 75, in _exec
conn.execute(construct, *multiparams, **params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 727, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 67, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 781, in _execute_ddl
compiled
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 954, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1116, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 189, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 947, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 435, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or near "utc"
LINE 5: ...AMP WITHOUT TIME ZONE DEFAULT '(now() at time zone 'utc')',
^
"\nCREATE TABLE test (\n\tid BIGSERIAL NOT NULL, \n\tcreated_at TIMESTAMP WITHOUT TIME ZONE DEFAULT 'now()', \n\tcreated_at2 TIMESTAMP WITHOUT TIME ZONE DEFAULT '(now() at time zone 'utc')', \n\tcreated_at3 TIMESTAMP WITHOUT TIME ZONE DEFAULT 'now()', \n\tPRIMARY KEY (id)\n)\n\n" {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment