From cf0a9263e63b05f3f05ea535d09894ad08937878 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 03 2016 20:35:51 +0000 Subject: Add a type_ to log entries This will allow us to easily figure out if a log entry if about a ticket, a pull-request, a commit or a project, or anything else in the future. --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 0ea9afc..9aff98f 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -3343,6 +3343,7 @@ def log_action(session, action, obj): log = model.PagureLog( user_id=obj.user_id, project_id=project_id, + type_=obj.isa, description=desc % arg, date=obj.date_created.date(), date_created=obj.date_created diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 3ead53f..4b8b7a4 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -1594,6 +1594,7 @@ class PagureLog(BASE): nullable=True, index=True ) + type_ = sa.Column(sa.Text, nullable=False) description = sa.Column(sa.Text, nullable=False) date = sa.Column( sa.Date, @@ -1629,6 +1630,7 @@ class PagureLog(BASE): ''' output = { 'id': self.id, + 'type': self.type_, 'description': self.description, 'date': self.date.strftime('%Y-%m-%d'), 'date_created': self.date_created.strftime('%s'),