Add LogEntry3 table without the extra indexes and switch to writing to it
This commit is contained in:
parent
b6db002729
commit
cdb49dbfd3
12 changed files with 114 additions and 49 deletions
|
@ -1039,6 +1039,26 @@ class LogEntry2(BaseModel):
|
|||
)
|
||||
|
||||
|
||||
class LogEntry3(BaseModel):
|
||||
id = BigAutoField()
|
||||
kind = ForeignKeyField(LogEntryKind)
|
||||
account = IntegerField(db_column='account_id')
|
||||
performer = IntegerField(null=True, db_column='performer_id')
|
||||
repository = IntegerField(null=True, db_column='repository_id')
|
||||
datetime = DateTimeField(default=datetime.now, index=True)
|
||||
ip = CharField(null=True)
|
||||
metadata_json = TextField(default='{}')
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
read_slaves = (read_slave,)
|
||||
indexes = (
|
||||
(('account', 'datetime'), False),
|
||||
(('performer', 'datetime'), False),
|
||||
(('repository', 'datetime', 'kind'), False),
|
||||
)
|
||||
|
||||
|
||||
class RepositoryActionCount(BaseModel):
|
||||
repository = ForeignKeyField(Repository)
|
||||
count = IntegerField()
|
||||
|
|
Reference in a new issue