Change id column in LogEntry to a BigInt and migrate back to using that table

This commit is contained in:
Joseph Schorr 2018-07-27 17:46:46 -04:00
parent 5e4d52f1fd
commit 7325b22c90
8 changed files with 56 additions and 22 deletions

View file

@ -7,7 +7,7 @@ from datetime import datetime, timedelta
from cachetools import lru_cache
import data
from data.database import LogEntry, LogEntry2, LogEntryKind, User, RepositoryActionCount, db
from data.database import LogEntry, LogEntryKind, User, RepositoryActionCount, db
from data.model import config, user, DataModelException
logger = logging.getLogger(__name__)
@ -101,7 +101,7 @@ def _json_serialize(obj):
def log_action(kind_name, user_or_organization_name, performer=None, repository=None, ip=None,
metadata={}, timestamp=None):
""" Logs an entry in the LogEntry2 table. """
""" Logs an entry in the LogEntry table. """
if not timestamp:
timestamp = datetime.today()
@ -132,7 +132,7 @@ def log_action(kind_name, user_or_organization_name, performer=None, repository=
}
try:
LogEntry2.create(**log_data)
LogEntry.create(**log_data)
except PeeweeException as ex:
strict_logging_disabled = config.app_config.get('ALLOW_PULLS_WITHOUT_STRICT_LOGGING')
if strict_logging_disabled and kind_name in ACTIONS_ALLOWED_WITHOUT_AUDIT_LOGGING: