Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Adds a canonical entity field so that we can dedupe
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjbowers committed Jun 8, 2017
1 parent fbdef0b commit cb44a00
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from fuzzywuzzy import fuzz, process
import peewee
from peewee import *
from pyiap.flask import VerifyJWTMiddleware
# from pyiap.flask import VerifyJWTMiddleware
import requests

import models
Expand Down
19 changes: 19 additions & 0 deletions apply_migrations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import models

from playhouse.migrate import *

"""
http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#schema-migrations
"""

migrator = SqliteMigrator(models.database)
migrations = {
"Add canonical entity field to entity.": migrator.add_column('entity', 'canonical_entity', CharField(null=True)),
}

for desc, m in migrations.items():
try:
print(desc)
migrate(m)
except Exception as e:
print("\tError: %s" % e)
1 change: 1 addition & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Meta:
class Entity(BaseModel):
id = UUIDField(primary_key=True)
name = CharField(max_length=255, unique=True)
canonical_entity = TextField(null=True)

def to_dict(self):
payload = self.__dict__['_data']
Expand Down

0 comments on commit cb44a00

Please sign in to comment.