From b7fefaae5a8aac79e59cdfff1d3afd70e8877725 Mon Sep 17 00:00:00 2001 From: Matt Drayer Date: Fri, 17 Jul 2015 12:03:39 -0400 Subject: [PATCH] Add initial database migration --- organizations/migrations/0001_initial.py | 69 ++++++++++++++++++++++++ organizations/migrations/__init__.py | 0 2 files changed, 69 insertions(+) create mode 100644 organizations/migrations/0001_initial.py create mode 100644 organizations/migrations/__init__.py diff --git a/organizations/migrations/0001_initial.py b/organizations/migrations/0001_initial.py new file mode 100644 index 00000000..c1e08343 --- /dev/null +++ b/organizations/migrations/0001_initial.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding model 'Organization' + db.create_table('organizations_organization', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), + ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), + ('description', self.gf('django.db.models.fields.TextField')()), + ('active', self.gf('django.db.models.fields.BooleanField')(default=True)), + )) + db.send_create_signal('organizations', ['Organization']) + + # Adding model 'OrganizationCourse' + db.create_table('organizations_organizationcourse', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), + ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), + ('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), + ('organization', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['organizations.Organization'])), + ('active', self.gf('django.db.models.fields.BooleanField')(default=True)), + )) + db.send_create_signal('organizations', ['OrganizationCourse']) + + # Adding unique constraint on 'OrganizationCourse', fields ['course_id', 'organization'] + db.create_unique('organizations_organizationcourse', ['course_id', 'organization_id']) + + + def backwards(self, orm): + # Removing unique constraint on 'OrganizationCourse', fields ['course_id', 'organization'] + db.delete_unique('organizations_organizationcourse', ['course_id', 'organization_id']) + + # Deleting model 'Organization' + db.delete_table('organizations_organization') + + # Deleting model 'OrganizationCourse' + db.delete_table('organizations_organizationcourse') + + + models = { + 'organizations.organization': { + 'Meta': {'object_name': 'Organization'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), + 'description': ('django.db.models.fields.TextField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) + }, + 'organizations.organizationcourse': { + 'Meta': {'unique_together': "(('course_id', 'organization'),)", 'object_name': 'OrganizationCourse'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}), + 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['organizations.Organization']"}) + } + } + + complete_apps = ['organizations'] \ No newline at end of file diff --git a/organizations/migrations/__init__.py b/organizations/migrations/__init__.py new file mode 100644 index 00000000..e69de29b