diff mbox

[07/15] series: Provide the migration step to add series

Message ID 1444387202-25735-8-git-send-email-damien.lespiau@intel.com
State Superseded
Headers show

Commit Message

Damien Lespiau Oct. 9, 2015, 10:39 a.m. UTC
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 patchwork/migrations/0003_series.py | 73 +++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 patchwork/migrations/0003_series.py

Comments

Stephen Finucane Oct. 9, 2015, 11:21 p.m. UTC | #1
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>


I think this should be part of the previous commit to make it bisectable. You also need raw SQL migrations in 'lib/sql' for Django 1.6 users (we haven't decided to drop support for that yet). Django will generate most of this for you: check out './manage.py --help'.

Stephen
diff mbox

Patch

diff --git a/patchwork/migrations/0003_series.py b/patchwork/migrations/0003_series.py
new file mode 100644
index 0000000..679c27c
--- /dev/null
+++ b/patchwork/migrations/0003_series.py
@@ -0,0 +1,73 @@ 
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import datetime
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('patchwork', '0002_fix_patch_state_default_values'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Series',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(max_length=200, null=True)),
+                ('submitted', models.DateTimeField(default=datetime.datetime.now)),
+                ('last_updated', models.DateTimeField(auto_now=True)),
+                ('version', models.IntegerField(default=1)),
+                ('n_patches', models.IntegerField(default=0)),
+                ('project', models.ForeignKey(to='patchwork.Project')),
+                ('reviewer', models.ForeignKey(related_name='reviewers', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+                ('submitter', models.ForeignKey(related_name='submitters', to='patchwork.Person')),
+            ],
+        ),
+        migrations.CreateModel(
+            name='SeriesRevision',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('version', models.IntegerField(default=1)),
+                ('root_msgid', models.CharField(max_length=255)),
+                ('cover_letter', models.TextField(null=True, blank=True)),
+            ],
+            options={
+                'ordering': ['version'],
+            },
+        ),
+        migrations.CreateModel(
+            name='SeriesRevisionPatch',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('order', models.IntegerField()),
+                ('patch', models.ForeignKey(to='patchwork.Patch')),
+                ('revision', models.ForeignKey(to='patchwork.SeriesRevision')),
+            ],
+            options={
+                'ordering': ['order'],
+            },
+        ),
+        migrations.AddField(
+            model_name='seriesrevision',
+            name='patches',
+            field=models.ManyToManyField(to='patchwork.Patch', through='patchwork.SeriesRevisionPatch'),
+        ),
+        migrations.AddField(
+            model_name='seriesrevision',
+            name='series',
+            field=models.ForeignKey(to='patchwork.Series'),
+        ),
+        migrations.AlterUniqueTogether(
+            name='seriesrevisionpatch',
+            unique_together=set([('revision', 'patch'), ('revision', 'order')]),
+        ),
+        migrations.AlterUniqueTogether(
+            name='seriesrevision',
+            unique_together=set([('series', 'version')]),
+        ),
+    ]