Add the event_uuid field to the Event model

This commit is contained in:
Gergely Polonkai 2018-07-09 12:11:15 +02:00
parent 1c2635045b
commit c7457f6ed1
1 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,12 @@ users_roles = db.Table(
db.Column('role_id', db.Integer(), db.ForeignKey('roles.id')))
def generate_uuid():
from uuid import uuid4
return uuid4().hex
class SettingsProxy:
"""Proxy object to get settings for a user
"""
@ -197,6 +203,9 @@ class Event(db.Model):
# pylint: disable=invalid-name
id = db.Column(db.Integer(), primary_key=True)
#: The UUID of the event. This is what is presented to the users and used in federation.
event_uuid = db.Column(db.String(length=40), unique=True, nullable=False, default=generate_uuid)
#: The ID of the user who created the event
user_id = db.Column(db.Integer(), db.ForeignKey('users.id'), nullable=False)