-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1307 from unicef/staging
Staging
- Loading branch information
Showing
286 changed files
with
2,442 additions
and
13,413 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
EquiTrack/EquiTrack/management/commands/clear-migrations-table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import logging | ||
|
||
from django.core.management import BaseCommand | ||
from django.db import connection, transaction | ||
|
||
from users.models import Country | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Clear Migration Table' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('--schema', dest='schema') | ||
|
||
@transaction.atomic | ||
def handle(self, *args, **options): | ||
|
||
logger.info(u'Command started') | ||
|
||
countries = Country.objects.exclude(name__iexact='global') | ||
if options['schema']: | ||
countries = countries.filter(schema_name=options['schema']) | ||
|
||
etools_apps = ','.join(["'audit'", "'activities'", "'attachments'", "'environment'", "'firms'", "'funds'", | ||
"'locations'", "'hact'", "'management'", "'notification'", "'partners'", "'publics'", | ||
"'purchase_order'", "'reports'", "'snapshot'", "'t2f'", "'tpm'", "'tpmpartners'", | ||
"'users'", "'vision'", | ||
"'trips'", "'supplies'", "'workplan'" # TODO remove these apps | ||
]) | ||
for country in countries: | ||
connection.set_tenant(country) | ||
logger.info(u'Clear table for %s' % country.name) | ||
with connection.cursor() as cursor: | ||
cursor.execute("DELETE FROM django_migrations WHERE app IN ({})".format(etools_apps)) | ||
|
||
logger.info(u'Command finished') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
EquiTrack/activities/migrations/0002_auto_20180326_1605.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.8 on 2018-03-26 16:05 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('activities', '0001_initial'), | ||
('locations', '0001_initial'), | ||
('reports', '0001_initial'), | ||
('partners', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='activity', | ||
name='cp_output', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Result', verbose_name='CP Output'), | ||
), | ||
migrations.AddField( | ||
model_name='activity', | ||
name='intervention', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.Intervention', verbose_name='Intervention'), | ||
), | ||
migrations.AddField( | ||
model_name='activity', | ||
name='locations', | ||
field=models.ManyToManyField(related_name='_activity_locations_+', to='locations.Location', verbose_name='Locations'), | ||
), | ||
migrations.AddField( | ||
model_name='activity', | ||
name='partner', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='Implementing Partner'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
EquiTrack/attachments/migrations/0002_auto_20170824_1319.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
EquiTrack/attachments/migrations/0004_auto_20171122_1533.py
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
EquiTrack/attachments/migrations/0005_auto_20180206_1700.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.