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 <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-08 03:02:04 -04:00
parent aaea84b386
commit fad2ae3683
12 changed files with 418 additions and 8 deletions

View File

@@ -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

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -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

View File

@@ -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):

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -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',
),
]

View File

@@ -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')]),
),
]

View File

@@ -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',
),
]

View File

@@ -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'),
),
]

View File

@@ -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',
},
),
]