hasgeek / hascore

Hasgeek legacy geonames API
3 stars 2 forks source link

GeoName should not have an autoincrementing primary key #14

Open jace opened 9 years ago

jace commented 9 years ago

SQLAlchemy provides an autoincrementing primary key by default (also referred to as "serial"). The GeoName table uses geonameid as the primary key and these numbers are externally defined, so the table should not have autoincrement enabled. We need to:

  1. Disable autoincrement in the model
  2. Add a migration to remove it from the database
ghost commented 8 years ago

I followed a Stackoverflow post regarding this issue, this could help I guess. (http://stackoverflow.com/questions/27498991/sqlalchemy-primary-key-without-auto-increment): $ geonameid = db.Column(db.Integer, primary_key=True, autoincrement=False)

jace commented 8 years ago

This takes care of point 1. We also need a migration for point 2.

ghost commented 8 years ago

@jace we modify the generated migration (for point 1) by hand for point 2, right?

jace commented 8 years ago

Try and see what you get. You need both forward and backward revisions.