Hi,
  
   Not knowing much about SQL stuff, I used Flask-Migrate, which use 
alembic, to deal with migrations.  But now I have to deal with a migration 
where I can't simply destroy the SQLite database and remake it.(which is 
how I dealt so far when an ALTER constraint message popped up)

So I read the doc on batch mode for SQLite, but I admit it makes no sense 
to me.  How can I take this line in the migration script
op.create_foreign_key(None, 'incomes', 'classtype', ['income_classtype'], 
['id'])

and transform it to use batch mode so it works with SQLite?

Basically, I'm adding a column to 2 tables with a one-to-one relationship.  
Here are the models in case it helps.  The new columns are the last line in 
both models.

class Income(db.Model):
    __tablename__='incomes'
    id = db.Column(db.Integer, primary_key=True)
    date = db.Column(db.DateTime)
    amount = db.Column(Numeric)
    user_ = db.Column(db.Integer, db.ForeignKey('users.id'))
    income_classtype = db.Column(db.Integer,db.ForeignKey('classtype.id'))

class ClassType(db.Model):
    __tablename__ = 'classtype'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True)
    default = db.Column(db.Boolean, default=False, index=True)
    class_ = db.relationship('Classes', backref='classtype', lazy='dynamic')
    punchcard_type = db.relationship('Punchcard', backref='classtype', 
lazy='dynamic')
    seasonpass_type = db.relationship('SeasonPass', backref='classtype', 
lazy='dynamic')
    income_type = db.relationship('Income',backref='classtype', lazy ='dynamic')



Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to