From fad2ae3683115ada73d3325c8456e671ecbc1b6c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 8 Dec 2018 03:02:04 -0400 Subject: [PATCH] Migrations: Squash migrations Squash together the following migrations: - Common: 0010 to 0011 - Documents: 0029 to 0037 - Documents: 0042 to 0043 - Tags: 0001 to 0008 Signed-off-by: Roberto Rosario --- HISTORY.rst | 6 + mayan/apps/common/migrations/0001_initial.py | 1 - .../migrations/0002_auto_20150608_1902.py | 1 - .../migrations/0006_auto_20160313_0313.py | 1 - .../migrations/0007_auto_20170118_1758.py | 1 - .../common/migrations/0008_errorlogentry.py | 4 +- .../migrations/0009_auto_20180402_0339.py | 1 - ...3_0702_squashed_0011_auto_20180429_0758.py | 29 ++++ .../migrations/0012_auto_20181203_0812.py | 124 +++++++++++++++ ...2_0755_squashed_0037_auto_20161231_0617.py | 144 ++++++++++++++++++ ...3_0702_squashed_0043_auto_20180429_0759.py | 48 ++++++ ...nitial_squashed_0008_auto_20180917_0646.py | 66 ++++++++ 12 files changed, 418 insertions(+), 8 deletions(-) create mode 100644 mayan/apps/common/migrations/0010_auto_20180403_0702_squashed_0011_auto_20180429_0758.py create mode 100644 mayan/apps/common/migrations/0012_auto_20181203_0812.py create mode 100644 mayan/apps/documents/migrations/0029_auto_20160122_0755_squashed_0037_auto_20161231_0617.py create mode 100644 mayan/apps/documents/migrations/0042_auto_20180403_0702_squashed_0043_auto_20180429_0759.py create mode 100644 mayan/apps/tags/migrations/0001_initial_squashed_0008_auto_20180917_0646.py diff --git a/HISTORY.rst b/HISTORY.rst index 380136fdf8..ba28e4be73 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -165,7 +165,13 @@ "AUTOADMIN_USERNAME". - Changed the use of the list/zip combinarion to generate the full list of metadata lookup choices to a generator. +- Squash migrations: + - Common: 0010 to 0011 + - Documents: 0029 to 0037 + - Documents: 0042 to 0043 + - Tags: 0001 to 0008 + 3.1.9 (2018-11-01) ================== - Convert the furl instance to text to allow serializing it into diff --git a/mayan/apps/common/migrations/0001_initial.py b/mayan/apps/common/migrations/0001_initial.py index 3c94d6b35c..98f8d7ada8 100644 --- a/mayan/apps/common/migrations/0001_initial.py +++ b/mayan/apps/common/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings diff --git a/mayan/apps/common/migrations/0002_auto_20150608_1902.py b/mayan/apps/common/migrations/0002_auto_20150608_1902.py index 10c4b2178f..2a10607799 100644 --- a/mayan/apps/common/migrations/0002_auto_20150608_1902.py +++ b/mayan/apps/common/migrations/0002_auto_20150608_1902.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/mayan/apps/common/migrations/0006_auto_20160313_0313.py b/mayan/apps/common/migrations/0006_auto_20160313_0313.py index 67c7af3a2f..5ab1d1ab0a 100644 --- a/mayan/apps/common/migrations/0006_auto_20160313_0313.py +++ b/mayan/apps/common/migrations/0006_auto_20160313_0313.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/mayan/apps/common/migrations/0007_auto_20170118_1758.py b/mayan/apps/common/migrations/0007_auto_20170118_1758.py index f48c2b0c6e..8546b5dc92 100644 --- a/mayan/apps/common/migrations/0007_auto_20170118_1758.py +++ b/mayan/apps/common/migrations/0007_auto_20170118_1758.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.5 on 2017-01-18 17:58 from __future__ import unicode_literals from django.db import migrations, models diff --git a/mayan/apps/common/migrations/0008_errorlogentry.py b/mayan/apps/common/migrations/0008_errorlogentry.py index 2401ff4eb4..5e11e1ddc3 100644 --- a/mayan/apps/common/migrations/0008_errorlogentry.py +++ b/mayan/apps/common/migrations/0008_errorlogentry.py @@ -1,9 +1,7 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2017-08-25 06:52 from __future__ import unicode_literals -import django.db.models.deletion from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): diff --git a/mayan/apps/common/migrations/0009_auto_20180402_0339.py b/mayan/apps/common/migrations/0009_auto_20180402_0339.py index b62b773bf3..5045dc0dd1 100644 --- a/mayan/apps/common/migrations/0009_auto_20180402_0339.py +++ b/mayan/apps/common/migrations/0009_auto_20180402_0339.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/mayan/apps/common/migrations/0010_auto_20180403_0702_squashed_0011_auto_20180429_0758.py b/mayan/apps/common/migrations/0010_auto_20180403_0702_squashed_0011_auto_20180429_0758.py new file mode 100644 index 0000000000..5818e1f025 --- /dev/null +++ b/mayan/apps/common/migrations/0010_auto_20180403_0702_squashed_0011_auto_20180429_0758.py @@ -0,0 +1,29 @@ +from __future__ import unicode_literals + +import django.core.files.storage +from django.db import migrations, models + +import mayan.apps.common.models + + +class Migration(migrations.Migration): + + replaces = [ + ('common', '0010_auto_20180403_0702'), + ('common', '0011_auto_20180429_0758') + ] + + dependencies = [ + ('common', '0009_auto_20180402_0339'), + ] + + operations = [ + migrations.AlterField( + field=models.FileField( + storage=django.core.files.storage.FileSystemStorage( + location='/home/rosarior/development/mayan-edms/mayan/media/shared_files' + ), upload_to=mayan.apps.common.models.upload_to, + verbose_name='File' + ), model_name='shareduploadedfile', name='file', + ), + ] diff --git a/mayan/apps/common/migrations/0012_auto_20181203_0812.py b/mayan/apps/common/migrations/0012_auto_20181203_0812.py new file mode 100644 index 0000000000..2e31e0a79c --- /dev/null +++ b/mayan/apps/common/migrations/0012_auto_20181203_0812.py @@ -0,0 +1,124 @@ +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('common', '0011_auto_20180429_0758'), + ] + + operations = [ + migrations.CreateModel( + name='Cache', + fields=[ + ( + 'id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID' + ) + ), + ( + 'name', models.CharField( + max_length=128, unique=True, verbose_name='Name' + ) + ), + ( + 'label', models.CharField( + max_length=128, verbose_name='Label' + ) + ), + ( + 'maximum_size', models.PositiveIntegerField( + verbose_name='Maximum size' + ) + ), + ( + 'storage_instance_path', models.CharField( + max_length=255, unique=True, + verbose_name='Storage instance path' + ) + ), + ], + options={ + 'verbose_name': 'Cache', + 'verbose_name_plural': 'Caches', + }, + ), + migrations.CreateModel( + name='CachePartition', + fields=[ + ( + 'id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID' + ) + ), + ( + 'name', models.CharField( + max_length=128, verbose_name='Name' + ) + ), + ( + 'cache', models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='partitions', to='common.Cache', + verbose_name='Cache' + ) + ), + ], + options={ + 'verbose_name': 'Cache partition', + 'verbose_name_plural': 'Cache partitions', + }, + ), + migrations.CreateModel( + name='CachePartitionFile', + fields=[ + ( + 'id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID' + ) + ), + ( + 'datetime', models.DateTimeField( + auto_now_add=True, db_index=True, + verbose_name='Date time' + ) + ), + ( + 'filename', models.CharField( + max_length=255, verbose_name='Filename' + ) + ), + ( + 'file_size', models.PositiveIntegerField( + default=0, verbose_name='File size' + ) + ), + ( + 'partition', models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='files', to='common.CachePartition', + verbose_name='Cache partition' + ) + ), + ], + options={ + 'get_latest_by': 'datetime', + 'verbose_name': 'Cache partition file', + 'verbose_name_plural': 'Cache partition files', + }, + ), + migrations.AlterUniqueTogether( + name='cachepartitionfile', + unique_together=set([('partition', 'filename')]), + ), + migrations.AlterUniqueTogether( + name='cachepartition', + unique_together=set([('cache', 'name')]), + ), + ] diff --git a/mayan/apps/documents/migrations/0029_auto_20160122_0755_squashed_0037_auto_20161231_0617.py b/mayan/apps/documents/migrations/0029_auto_20160122_0755_squashed_0037_auto_20161231_0617.py new file mode 100644 index 0000000000..986e53ddc9 --- /dev/null +++ b/mayan/apps/documents/migrations/0029_auto_20160122_0755_squashed_0037_auto_20161231_0617.py @@ -0,0 +1,144 @@ +from __future__ import unicode_literals + +import uuid + +from django.db import connection, migrations, models +import django.db.models.deletion + + +def operation_convert_uuid_to_hex(apps, schema_editor): + Document = apps.get_model('documents', 'Document') + + for document in Document.objects.using(schema_editor.connection.alias).all(): + document.uuid = uuid.UUID(document.uuid).hex + document.save() + + +def operation_convert_uuid_model_field_to_native_minus_oracle(apps, schema_editor): + if not schema_editor.connection.vendor == 'oracle': + # Skip this migration for Oracle + # GitHub issue #251 + migrations.AlterField( + field=models.UUIDField(default=uuid.uuid4, editable=False), + model_name='document', name='uuid', + ) + + +def operation_convert_uuid_db_field_to_native_postgresql(apps, schema_editor): + if connection.vendor == 'postgresql': + migrations.RunSQL( + 'ALTER TABLE documents_document ALTER COLUMN uuid SET ' + 'DATA TYPE UUID USING uuid::uuid;' + ) + + +class Migration(migrations.Migration): + + replaces = [ + ('documents', '0029_auto_20160122_0755'), + ('documents', '0030_auto_20160309_1837'), + ('documents', '0031_convert_uuid'), + ('documents', '0032_auto_20160315_0537'), + ('documents', '0033_auto_20160325_0052'), + ('documents', '0034_auto_20160509_2321'), + ('documents', '0035_auto_20161102_0633'), + ('documents', '0036_auto_20161222_0534'), + ('documents', '0037_auto_20161231_0617') + ] + + dependencies = [ + ('documents', '0028_newversionblock'), + ] + + operations = [ + migrations.AlterField( + field=models.CharField( + blank=True, default='eng', max_length=8, + verbose_name='Language' + ), model_name='document', name='language', + ), + migrations.AlterField( + field=models.PositiveIntegerField( + blank=True, default=30, help_text='Amount of time after ' + 'which documents of this type in the trash will be ' + 'deleted.', null=True, verbose_name='Delete time period' + ), model_name='documenttype', name='delete_time_period', + ), + migrations.AlterField( + field=models.CharField( + blank=True, choices=[ + ('days', 'Days'), ('hours', 'Hours'), + ('minutes', 'Minutes') + ], default='days', max_length=8, null=True, + verbose_name='Delete time unit' + ), model_name='documenttype', name='delete_time_unit', + ), + migrations.RunPython( + code=operation_convert_uuid_to_hex, + ), + migrations.RunPython( + code=operation_convert_uuid_model_field_to_native_minus_oracle, + ), + migrations.RunPython( + code=operation_convert_uuid_db_field_to_native_postgresql, + ), + migrations.AlterModelOptions( + name='documenttypefilename', options={ + 'ordering': ('filename',), 'verbose_name': 'Quick label', + 'verbose_name_plural': 'Quick labels' + }, + ), + migrations.AlterField( + field=models.BooleanField( + db_index=True, default=False, editable=False, + verbose_name='In trash?' + ), model_name='document', name='in_trash', + ), + migrations.AlterField( + field=models.BooleanField( + db_index=True, default=True, editable=False, help_text='A ' + 'document stub is a document with an entry on the database ' + 'but no file uploaded. This could be an interrupted upload ' + 'or a deferred upload via the API.', verbose_name='Is stub?' + ), model_name='document', name='is_stub', + ), + migrations.CreateModel( + fields=[ + ( + 'id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID' + ) + ), + ( + 'filename', models.CharField( + max_length=128, verbose_name='Filename' + ) + ), + ], name='DocumentPageCachedImage', options={ + 'verbose_name': 'Document page cached image', + 'verbose_name_plural': 'Document page cached images', + }, + ), + migrations.CreateModel( + bases=('documents.documentpage',), fields=[], + name='DocumentPageResult', options={ + 'ordering': ('document_version__document', 'page_number'), + 'proxy': True, 'verbose_name': 'Document page', + 'verbose_name_plural': 'Document pages', + }, + ), + migrations.AddField( + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='cached_images', to='documents.DocumentPage', + verbose_name='Document page' + ), model_name='documentpagecachedimage', name='document_page', + ), + migrations.RemoveField( + model_name='newversionblock', name='document', + ), + migrations.DeleteModel( + name='NewVersionBlock', + ), + ] diff --git a/mayan/apps/documents/migrations/0042_auto_20180403_0702_squashed_0043_auto_20180429_0759.py b/mayan/apps/documents/migrations/0042_auto_20180403_0702_squashed_0043_auto_20180429_0759.py new file mode 100644 index 0000000000..556f4a7f95 --- /dev/null +++ b/mayan/apps/documents/migrations/0042_auto_20180403_0702_squashed_0043_auto_20180429_0759.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-12-08 06:35 +from __future__ import unicode_literals + +import django.core.files.storage +from django.db import migrations, models +import mayan.apps.documents.utils + + +class Migration(migrations.Migration): + + replaces = [ + ('documents', '0042_auto_20180403_0702'), + ('documents', '0043_auto_20180429_0759') + ] + + dependencies = [ + ('documents', '0041_auto_20170823_1855'), + ] + + operations = [ + migrations.AlterField( + field=models.FileField( + storage=django.core.files.storage.FileSystemStorage( + location=b'mayan/media/document_storage' + ), upload_to=mayan.apps.documents.utils.document_uuid_function, + verbose_name='File' + ), model_name='documentversion', name='file', + ), + migrations.AlterField( + model_name='documentversion', + name='encoding', + field=models.CharField(blank=True, editable=False, max_length=64, null=True, verbose_name='Encoding'), + ), + migrations.AlterField( + field=models.FileField( + storage=django.core.files.storage.FileSystemStorage( + location=b'/home/rosarior/development/mayan-edms/mayan/media/document_storage' + ), upload_to=mayan.apps.documents.utils.document_uuid_function, + verbose_name='File' + ), model_name='documentversion', name='file', + ), + migrations.AlterField( + model_name='documentversion', + name='mimetype', + field=models.CharField(blank=True, editable=False, max_length=255, null=True, verbose_name='MIME type'), + ), + ] diff --git a/mayan/apps/tags/migrations/0001_initial_squashed_0008_auto_20180917_0646.py b/mayan/apps/tags/migrations/0001_initial_squashed_0008_auto_20180917_0646.py new file mode 100644 index 0000000000..0ceff04e9a --- /dev/null +++ b/mayan/apps/tags/migrations/0001_initial_squashed_0008_auto_20180917_0646.py @@ -0,0 +1,66 @@ +from __future__ import unicode_literals + +from django.db import migrations, models + +import colorful.fields + + +class Migration(migrations.Migration): + + replaces = [ + ('tags', '0001_initial'), + ('tags', '0002_tag_selection'), + ('tags', '0003_remove_tag_color'), + ('tags', '0004_auto_20150717_2336'), + ('tags', '0005_auto_20150718_0616'), + ('tags', '0006_documenttag'), + ('tags', '0007_auto_20170118_1758'), + ('tags', '0008_auto_20180917_0646') + ] + + dependencies = [ + ('documents', '__first__'), + ] + + operations = [ + migrations.CreateModel( + fields=[ + ( + 'id', models.AutoField( + auto_created=True, primary_key=True, serialize=False, + verbose_name='ID' + ) + ), + ( + 'label', models.CharField( + db_index=True, help_text='A short text used as the ' + 'tag name.', max_length=128, unique=True, + verbose_name='Label' + ) + ), + ( + 'color', colorful.fields.RGBColorField( + help_text='The RGB color values for the tag.', + verbose_name='Color' + ) + ), + ( + 'documents', models.ManyToManyField( + related_name='tags', to='documents.Document', + verbose_name='Documents' + ) + ), + ], name='Tag', options={ + 'ordering': ('label',), + 'verbose_name': 'Tag', + 'verbose_name_plural': 'Tags', + }, + ), + migrations.CreateModel( + bases=('tags.tag',), fields=[], name='DocumentTag', + options={ + 'proxy': True, 'verbose_name': 'Document tag', + 'verbose_name_plural': 'Document tags', + }, + ), + ]