title: SQLAlchemy-Migrate or Alembic deletes data when renaming model
body: <p>I am using SQLAlchemy-Migrate to manage migrations for my PostgreSQL database. I changed the <code>__tablename__</code> for a model, and running the migration changed the name in the database, but all the rows in the table were deleted. How can I rename a model without deleting data?</p>
  
  <pre><code>class Contract(db.Model):
      __tablename__ = 'contract'
      id = db.Column(db.Integer, primary_key=True)
      is_valid = db.Column(db.Boolean, default=IS_VALID)
  </code></pre>
  
  <p>I rename it from <code>contract</code> to <code>contracts</code> and get this migration:</p>
  
  <pre><code>def upgrade(migrate_engine):
      pre_meta.bind = migrate_engine
      post_meta.bind = migrate_engine
      pre_meta.tables['contract'].drop()
      post_meta.tables['contracts'].create()
  </code></pre>
  
  <p>It drops the old table and creates a new one. I never examined other migration scripts because they always ran without dropping the data.</p>