Remove obsolete management commands from various field additions.

(imported from commit b44a2b683768c790839e82e2e9c9a18827670113)
This commit is contained in:
Tim Abbott
2013-10-31 14:51:43 -04:00
parent f0580dd28c
commit 384f64d38d
2 changed files with 0 additions and 55 deletions

View File

@@ -1,38 +0,0 @@
#!/usr/bin/python
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.models import Realm
import datetime
# Pulled from event logs on staging.
times = """"""
# Pulled from event logs on prod.
times = times + """"""
times = times + """"""
times_dict = {}
for row in times.split("\n"):
domain, timestr = row.split(" ")
timestamp = datetime.datetime.fromtimestamp(int(timestr))
times_dict[domain] = timestamp
class Command(BaseCommand):
help = """Set the realm creation time for all existing realms."""
def handle(self, **options):
for realm in Realm.objects.all():
timestamp = times_dict.get(realm.domain)
if timestamp:
print "Saving", realm.domain, timestamp
realm.date_created = timestamp
realm.save()
else:
print "Couldn't find data for", realm.domain

View File

@@ -1,17 +0,0 @@
#!/usr/bin/python
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.lib.utils import generate_random_token
from zerver.models import Stream
class Command(BaseCommand):
help = """Set a token for all streams that don't have one."""
def handle(self, **options):
streams_needing_tokens = Stream.objects.filter(email_token=None)
for stream in streams_needing_tokens:
stream.email_token = generate_random_token(32)
stream.save()