|
|
@ -1,19 +1,36 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Generated by Django 1.11 on 2018-08-14 19:21 |
|
|
|
|
|
from __future__ import unicode_literals |
|
|
|
|
|
|
|
|
|
|
|
from django.db import migrations, models |
|
|
|
|
|
|
|
|
# Generated by Django 2.1 on 2018-09-22 14:30 |
|
|
|
|
|
from django.core.exceptions import ImproperlyConfigured |
|
|
|
|
|
from django.db import migrations, connection, models |
|
|
from statistics.fields import UnixDateTimeField |
|
|
from statistics.fields import UnixDateTimeField |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def psql_migr(apps, _): |
|
|
|
|
|
# pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration): |
|
|
class Migration(migrations.Migration): |
|
|
|
|
|
|
|
|
dependencies = [ |
|
|
dependencies = [ |
|
|
('abonapp', '0002_auto_20180808_1448'), |
|
|
|
|
|
|
|
|
('abonapp', '0005_current_tariff'), |
|
|
('statistics', '0002_auto_20180808_1236'), |
|
|
('statistics', '0002_auto_20180808_1236'), |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
operations = [ |
|
|
operations = [ |
|
|
migrations.RunSQL( |
|
|
|
|
|
|
|
|
migrations.AlterModelOptions( |
|
|
|
|
|
name='statcache', |
|
|
|
|
|
options={'ordering': ('-last_time',)}, |
|
|
|
|
|
), |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db_e = connection.settings_dict.get('ENGINE') |
|
|
|
|
|
if db_e is None: |
|
|
|
|
|
raise ImproperlyConfigured('Database ENGINE is not set') |
|
|
|
|
|
# if 'postgresql' in db_e: |
|
|
|
|
|
# # Postgres |
|
|
|
|
|
Migration.operations.insert(0, migrations.RunPython(psql_migr)) |
|
|
|
|
|
if 'mysql' in db_e: |
|
|
|
|
|
Migration.operations.insert(0, migrations.RunSQL( |
|
|
( |
|
|
( |
|
|
"DROP TABLE `flowcache`;", |
|
|
"DROP TABLE `flowcache`;", |
|
|
"CREATE TABLE `flowcache` ( " |
|
|
"CREATE TABLE `flowcache` ( " |
|
|
@ -39,5 +56,24 @@ class Migration(migrations.Migration): |
|
|
}, |
|
|
}, |
|
|
) |
|
|
) |
|
|
] |
|
|
] |
|
|
|
|
|
)) |
|
|
|
|
|
else: |
|
|
|
|
|
Migration.operations.extend( |
|
|
|
|
|
( |
|
|
|
|
|
migrations.DeleteModel(name='statcache'), |
|
|
|
|
|
migrations.CreateModel( |
|
|
|
|
|
name='statcache', |
|
|
|
|
|
fields=[ |
|
|
|
|
|
('last_time', UnixDateTimeField()), |
|
|
|
|
|
('abon', models.OneToOneField('abonapp.Abon', on_delete=models.CASCADE, primary_key=True)), |
|
|
|
|
|
('octets', models.PositiveIntegerField(default=0)), |
|
|
|
|
|
('packets', models.PositiveIntegerField(default=0)) |
|
|
|
|
|
], |
|
|
|
|
|
options={ |
|
|
|
|
|
'db_table': 'flowcache', |
|
|
|
|
|
'ordering': ('-last_time',), |
|
|
|
|
|
#'db_tablespace': 'ram' |
|
|
|
|
|
}, |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
) |
|
|
) |
|
|
] |
|
|
|