RateMyCourse/backend/postings/migrations/0001_initial.py

112 lines
4.7 KiB
Python
Raw Normal View History

# Generated by Django 2.1.1 on 2018-10-02 13:24
2018-09-16 16:52:23 +00:00
from django.db import migrations, models
import django.db.models.deletion
2018-09-16 16:52:23 +00:00
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RateableEntity',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=256)),
('created_date', models.DateTimeField(auto_now_add=True)),
('entity_type', models.SmallIntegerField(choices=[(0, 'University'), (1, 'Course'), (2, 'Professor')])),
],
),
migrations.CreateModel(
name='Review',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('rating', models.IntegerField(default=1)),
('title', models.CharField(max_length=128)),
('content', models.TextField()),
('created_date', models.DateTimeField(auto_now_add=True)),
('last_updated_date', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='ReviewHelpfulVote',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('helpful', models.BooleanField()),
('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.Review')),
],
),
2018-09-16 16:52:23 +00:00
migrations.CreateModel(
name='UniversityReview',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('university_name', models.CharField(max_length=200)),
('username', models.CharField(max_length=200)),
('rating', models.IntegerField(default=1)),
('title', models.CharField(max_length=200)),
('date_published', models.DateTimeField(auto_now_add=True)),
2018-09-16 16:52:23 +00:00
('content', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=64)),
('birth_date', models.DateField()),
],
),
migrations.CreateModel(
name='Course',
fields=[
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
],
bases=('postings.rateableentity',),
),
migrations.CreateModel(
name='Professor',
fields=[
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
],
bases=('postings.rateableentity',),
),
migrations.CreateModel(
name='University',
fields=[
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
('website_url', models.URLField()),
('location', models.CharField(max_length=256)),
],
bases=('postings.rateableentity',),
),
migrations.AddField(
model_name='review',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='postings.User'),
),
migrations.AddField(
model_name='review',
name='rateable_entity',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.RateableEntity'),
),
migrations.AddField(
model_name='professor',
name='universities',
field=models.ManyToManyField(to='postings.University'),
),
migrations.AddField(
model_name='course',
name='professors',
field=models.ManyToManyField(to='postings.Professor'),
),
migrations.AddField(
model_name='course',
name='taught_at_university',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.University'),
),
2018-09-16 16:52:23 +00:00
]