-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c316e41
commit 4942c44
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import peewee as pw | ||
from peewee_migrate import Migrator | ||
|
||
|
||
def migrate(migrator: Migrator, database: pw.Database, *, fake=False): | ||
"""Drop unused indices: | ||
- prediction_data: 6242 MB in prod | ||
- prediction_source_image: 1795 MB in prod | ||
- product_insight_bounding_box: 188 MB in prod | ||
- product_insight_confidence: 332 MB in prod | ||
- image_prediction_model_version: 533 MB in prod | ||
- product_insight_username: 661 MB in prod | ||
""" | ||
migrator.sql("DROP INDEX IF EXISTS prediction_data") | ||
migrator.sql("DROP INDEX IF EXISTS prediction_source_image") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS logo_confidence_threshold_type") | ||
migrator.sql("DROP INDEX IF EXISTS logoconfidencethreshold_type") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS logo_confidence_threshold_value") | ||
migrator.sql("DROP INDEX IF EXISTS logoconfidencethreshold_value") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS product_insight_bounding_box") | ||
migrator.sql("DROP INDEX IF EXISTS productinsight_bounding_box") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS product_insight_confidence") | ||
migrator.sql("DROP INDEX IF EXISTS productinsight_confidence") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS image_prediction_model_version") | ||
migrator.sql("DROP INDEX IF EXISTS imagepredictionmodel_version") | ||
|
||
migrator.sql("DROP INDEX IF EXISTS product_insight_username") | ||
migrator.sql("DROP INDEX IF EXISTS productinsight_username") | ||
|
||
|
||
def rollback(migrator: Migrator, database: pw.Database, *, fake=False): | ||
"""These indices are too long to build using a migration script, rollback | ||
should be done manually.""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters