layerindex-web/layerindex/migrations/0005_layerupdate.py
Paul Eggleton 43203c578c Record and display update logs
At the moment it's a bit difficult to get update logs out of the
environment in which the update script is being run. In order to make
the logs more accessible, create a LayerUpdate model to record the
output of update_layer.py separately for each layerbranch and tie the
created LayerUpdates together with a single Update model per session.

We provide two ways to look at this - a Tools->Updates page for
logged-in users, and there's also an "Updates" tab on each layer that is
accessible to anyone; which one is useful depends on whether you are
looking at the index as a whole or an individual layer.

Update records older than 30 days are deleted automatically by default.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-16 15:31:46 +13:00

47 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layerindex', '0004_layerdependency_required'),
]
operations = [
migrations.CreateModel(
name='LayerUpdate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('started', models.DateTimeField()),
('finished', models.DateTimeField()),
('errors', models.IntegerField(default=0)),
('warnings', models.IntegerField(default=0)),
('log', models.TextField(blank=True)),
('layerbranch', models.ForeignKey(to='layerindex.LayerBranch')),
],
),
migrations.CreateModel(
name='Update',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('started', models.DateTimeField()),
('finished', models.DateTimeField(null=True, blank=True)),
('log', models.TextField(blank=True)),
('reload', models.BooleanField(help_text='Was this update a reload?', verbose_name='Reloaded', default=False)),
],
),
migrations.AlterField(
model_name='branch',
name='name',
field=models.CharField(max_length=50, verbose_name='Branch name'),
),
migrations.AddField(
model_name='layerupdate',
name='update',
field=models.ForeignKey(to='layerindex.Update'),
),
]