Skip to content

Commit

Permalink
Add initial database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Drayer committed Jul 17, 2015
1 parent 52e411d commit b7fefaa
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions organizations/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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']
Empty file.

0 comments on commit b7fefaa

Please sign in to comment.