create index to harvest_object
This commit is contained in:
parent
28c5c68c36
commit
633a32075e
|
@ -8,6 +8,7 @@ from sqlalchemy import Table
|
||||||
from sqlalchemy import Column
|
from sqlalchemy import Column
|
||||||
from sqlalchemy import ForeignKey
|
from sqlalchemy import ForeignKey
|
||||||
from sqlalchemy import types
|
from sqlalchemy import types
|
||||||
|
from sqlalchemy import Index
|
||||||
from sqlalchemy.engine.reflection import Inspector
|
from sqlalchemy.engine.reflection import Inspector
|
||||||
from sqlalchemy.orm import backref, relation
|
from sqlalchemy.orm import backref, relation
|
||||||
from sqlalchemy.exc import InvalidRequestError
|
from sqlalchemy.exc import InvalidRequestError
|
||||||
|
@ -86,6 +87,12 @@ def setup():
|
||||||
sources_to_migrate = [s[0] for s in sources_to_migrate]
|
sources_to_migrate = [s[0] for s in sources_to_migrate]
|
||||||
migrate_v3_create_datasets(sources_to_migrate)
|
migrate_v3_create_datasets(sources_to_migrate)
|
||||||
|
|
||||||
|
# Check if harvest_object has a index
|
||||||
|
index_names = [index['name'] for index in inspector.get_indexes("harvest_object")]
|
||||||
|
if not "harvest_job_id_idx" in index_names:
|
||||||
|
log.debug('Creating index for harvest_object')
|
||||||
|
Index("harvest_job_id_idx", harvest_object_table.c.harvest_job_id).create()
|
||||||
|
|
||||||
|
|
||||||
class HarvestError(Exception):
|
class HarvestError(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -266,6 +273,7 @@ def define_harvester_tables():
|
||||||
Column('package_id', types.UnicodeText, ForeignKey('package.id', deferrable=True), nullable=True),
|
Column('package_id', types.UnicodeText, ForeignKey('package.id', deferrable=True), nullable=True),
|
||||||
# report_status: 'added', 'updated', 'not modified', 'deleted', 'errored'
|
# report_status: 'added', 'updated', 'not modified', 'deleted', 'errored'
|
||||||
Column('report_status', types.UnicodeText, nullable=True),
|
Column('report_status', types.UnicodeText, nullable=True),
|
||||||
|
Index('harvest_job_id_idx', 'harvest_job_id'),
|
||||||
)
|
)
|
||||||
|
|
||||||
# New table
|
# New table
|
||||||
|
|
Loading…
Reference in New Issue