我用于添加新 postgis 几何点的 alembic 更新脚本如下所示:
from alembic import op
import sqlalchemy as sa
import geoalchemy2 as ga
def upgrade():
op.add_column('stuff', sa.Column('my_location', ga.Geometry('POINT', management=True)))
def downgrade():
pass
当我通过运行脚本时
alembic upgrade head
发生以下错误
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) type modifier is not allowed for type "geometry"
LINE 1: ALTER TABLE events ADD COLUMN location geometry(POINT,-1)
我正在使用 postgres 9.1、postgis 1.5、sqlalchemy 1.0.9、geoalchemy2 0.2.6。