Add some indexes.
This commit is contained in:
parent
ee17f7a12f
commit
744056a58d
@ -25,26 +25,33 @@ from accountant import db
|
||||
class Operation(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
||||
operation_date = db.Column(db.Date, nullable=False)
|
||||
operation_date = db.Column(
|
||||
db.Date,
|
||||
nullable=False,
|
||||
default=arrow.now().date(),
|
||||
server_default=func.current_date(),
|
||||
index=True
|
||||
)
|
||||
label = db.Column(db.String(500), nullable=False)
|
||||
value = db.Column(db.Numeric(15, 2), nullable=False)
|
||||
|
||||
scheduled_operation_id = db.Column(
|
||||
db.Integer,
|
||||
db.ForeignKey('scheduled_operation.id')
|
||||
db.ForeignKey('scheduled_operation.id'),
|
||||
index=True
|
||||
)
|
||||
|
||||
scheduled_operation = db.relationship(
|
||||
"ScheduledOperation", backref=db.backref('entry', lazy="dynamic")
|
||||
)
|
||||
|
||||
account_id = db.Column(db.Integer, db.ForeignKey('account.id'))
|
||||
account_id = db.Column(db.Integer, db.ForeignKey('account.id'), index=True)
|
||||
|
||||
account = db.relationship(
|
||||
'Account', backref=db.backref('operation', lazy="dynamic")
|
||||
)
|
||||
|
||||
category = db.Column(db.String(100), nullable=True)
|
||||
category = db.Column(db.String(100), nullable=True, index=True)
|
||||
|
||||
pointed = db.Column(
|
||||
db.Boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user