Migrate data models to Django conventions
- add foreign keys - rename foreign key fields - rename tables to cats_*
This commit is contained in:
parent
35ae769e76
commit
f41126894a
10 changed files with 433 additions and 77 deletions
44
cats/migrations/0007_alter_topic_type_id.py
Normal file
44
cats/migrations/0007_alter_topic_type_id.py
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 16:55
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0006_change_auto_id_fields_to_bigautofield"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="topictype",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="topic",
|
||||||
|
name="type_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
db_column="type_id",
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="cats.topictype",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="topic",
|
||||||
|
old_name="type_id",
|
||||||
|
new_name="topic_type",
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="topic",
|
||||||
|
name="topic_type",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="cats.topictype"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="topic",
|
||||||
|
old_name="numofqu",
|
||||||
|
new_name="number_of_questions",
|
||||||
|
),
|
||||||
|
]
|
37
cats/migrations/0008_alter_questiontype_options_and_more.py
Normal file
37
cats/migrations/0008_alter_questiontype_options_and_more.py
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:23
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0007_alter_topic_type_id"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="questiontype",
|
||||||
|
options={"verbose_name": "Question Type"},
|
||||||
|
),
|
||||||
|
migrations.AlterModelTableComment(
|
||||||
|
name="questiontype",
|
||||||
|
table_comment=None,
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="questiontype",
|
||||||
|
name="de",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="questiontype",
|
||||||
|
name="en",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="questiontype",
|
||||||
|
name="fr",
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="questiontype",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
]
|
47
cats/migrations/0009_questiontypename.py
Normal file
47
cats/migrations/0009_questiontypename.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0008_alter_questiontype_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="QuestionTypeName",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("lang", models.CharField(max_length=5)),
|
||||||
|
("name", models.CharField(max_length=25)),
|
||||||
|
(
|
||||||
|
"question_type",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="cats.questiontype",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Question Type Name",
|
||||||
|
"unique_together": {("question_type", "lang")},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.RunSQL(
|
||||||
|
"INSERT INTO cats_questiontypename (question_type_id, lang, name) SELECT qt_id, lang, qt_desc FROM questiontype_v2"
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="QuestionTypeV2",
|
||||||
|
),
|
||||||
|
]
|
73
cats/migrations/0010_alter_model_tables.py
Normal file
73
cats/migrations/0010_alter_model_tables.py
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:37
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0009_questiontypename"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="question",
|
||||||
|
options={"verbose_name": "Question"},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="topic",
|
||||||
|
options={"verbose_name": "Topic"},
|
||||||
|
),
|
||||||
|
migrations.AlterModelTableComment(
|
||||||
|
name="question",
|
||||||
|
table_comment=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTableComment(
|
||||||
|
name="topic",
|
||||||
|
table_comment=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="answer",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="incorrectanswer",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="learnprogress",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="question",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="questiondescription",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="schemaversion",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="statistics",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="temp",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="topic",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="user",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="useraddress",
|
||||||
|
table=None,
|
||||||
|
),
|
||||||
|
]
|
28
cats/migrations/0011_rename_fields.py
Normal file
28
cats/migrations/0011_rename_fields.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:43
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0010_alter_model_tables"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="question",
|
||||||
|
old_name="translationstatus",
|
||||||
|
new_name="translation_status",
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="user",
|
||||||
|
old_name="sendcert",
|
||||||
|
new_name="send_certificate",
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="useraddress",
|
||||||
|
old_name="housenumber",
|
||||||
|
new_name="house_number",
|
||||||
|
),
|
||||||
|
]
|
38
cats/migrations/0012_add_question_foreign_keys.py
Normal file
38
cats/migrations/0012_add_question_foreign_keys.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:49
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0011_rename_fields"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="question",
|
||||||
|
name="qt_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="cats.questiontype"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="question",
|
||||||
|
old_name="qt_id",
|
||||||
|
new_name="question_type",
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="question",
|
||||||
|
name="t_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="cats.topic"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="question",
|
||||||
|
old_name="t_id",
|
||||||
|
new_name="topic",
|
||||||
|
),
|
||||||
|
]
|
22
cats/migrations/0013_question_explanation.py
Normal file
22
cats/migrations/0013_question_explanation.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 17:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0012_add_question_foreign_keys"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="question",
|
||||||
|
name="explanation",
|
||||||
|
field=models.TextField(blank=True),
|
||||||
|
),
|
||||||
|
migrations.RunSQL(
|
||||||
|
"UPDATE cats_question JOIN cats_questiondescription ON cats_question.id=cats_questiondescription.q_id"
|
||||||
|
" SET cats_question.explanation = cats_questiondescription.description"
|
||||||
|
),
|
||||||
|
migrations.DeleteModel("QuestionDescription"),
|
||||||
|
]
|
30
cats/migrations/0014_change_question_self_reference.py
Normal file
30
cats/migrations/0014_change_question_self_reference.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 18:08
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0013_question_explanation"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="question",
|
||||||
|
name="ref_q_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="referenced",
|
||||||
|
to="cats.question",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="question",
|
||||||
|
old_name="ref_q_id",
|
||||||
|
new_name="reference_question",
|
||||||
|
),
|
||||||
|
]
|
47
cats/migrations/0015_refactor_answer_model.py
Normal file
47
cats/migrations/0015_refactor_answer_model.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 18:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("cats", "0014_change_question_self_reference"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="answer",
|
||||||
|
name="q_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="cats.question"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="answer",
|
||||||
|
old_name="q_id",
|
||||||
|
new_name="question",
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="answer",
|
||||||
|
name="correct",
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="answer",
|
||||||
|
name="ref_a_id",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="referenced",
|
||||||
|
to="cats.answer",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="answer",
|
||||||
|
old_name="ref_a_id",
|
||||||
|
new_name="reference_answer",
|
||||||
|
),
|
||||||
|
]
|
144
cats/models.py
144
cats/models.py
|
@ -11,151 +11,141 @@ from django.db import models
|
||||||
class TopicType(models.Model):
|
class TopicType(models.Model):
|
||||||
text = models.CharField(max_length=255)
|
text = models.CharField(max_length=255)
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'topic_type'
|
|
||||||
|
|
||||||
|
|
||||||
class Topic(models.Model):
|
class Topic(models.Model):
|
||||||
topic = models.CharField(unique=True, max_length=50, db_comment='Thema')
|
topic = models.CharField(unique=True, max_length=50, db_comment="Thema")
|
||||||
active = models.IntegerField()
|
active = models.IntegerField()
|
||||||
numofqu = models.IntegerField(db_column='numOfQu') # Field name made lowercase.
|
number_of_questions = models.IntegerField(
|
||||||
|
db_column="numOfQu"
|
||||||
|
) # Field name made lowercase.
|
||||||
percentage = models.IntegerField()
|
percentage = models.IntegerField()
|
||||||
lang = models.CharField(max_length=42, blank=True, null=True)
|
lang = models.CharField(max_length=42, blank=True, null=True)
|
||||||
type_id = models.IntegerField(blank=True, null=True)
|
topic_type = models.ForeignKey(TopicType, on_delete=models.CASCADE)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'topics'
|
verbose_name = "Topic"
|
||||||
db_table_comment = 'Themen'
|
|
||||||
|
|
||||||
|
|
||||||
class QuestionType(models.Model):
|
class QuestionType(models.Model):
|
||||||
de = models.CharField(db_column='DE', max_length=25, db_comment='Fragetyp') # Field name made lowercase.
|
class Meta:
|
||||||
en = models.CharField(db_column='EN', max_length=25) # Field name made lowercase.
|
verbose_name = "Question Type"
|
||||||
fr = models.CharField(db_column='FR', max_length=25, blank=True, null=True) # Field name made lowercase.
|
|
||||||
|
|
||||||
|
class QuestionTypeName(models.Model):
|
||||||
|
question_type = models.ForeignKey(QuestionType, on_delete=models.CASCADE)
|
||||||
|
lang = models.CharField(max_length=5)
|
||||||
|
name = models.CharField(max_length=25)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'questiontype'
|
verbose_name = "Question Type Name"
|
||||||
db_table_comment = 'Fragetypen'
|
unique_together = (("question_type", "lang"),)
|
||||||
|
|
||||||
|
|
||||||
class QuestionTypeV2(models.Model):
|
|
||||||
qt_id = models.AutoField(primary_key=True, db_comment='Fragetypenschlssel') # The composite primary key (qt_id, lang) found, that is not supported. The first column is selected.
|
|
||||||
lang = models.CharField(max_length=5, db_comment='Sprache')
|
|
||||||
qt_desc = models.CharField(max_length=25, db_comment='Fragetyp')
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'questiontype_v2'
|
|
||||||
unique_together = (('qt_id', 'lang'),)
|
|
||||||
db_table_comment = 'Fragetypen'
|
|
||||||
|
|
||||||
|
|
||||||
class Question(models.Model):
|
class Question(models.Model):
|
||||||
qt_id = models.IntegerField(db_comment='Fragetyp')
|
question_type = models.ForeignKey(QuestionType, on_delete=models.CASCADE)
|
||||||
t_id = models.IntegerField(db_comment='Topic_id')
|
topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
|
||||||
question = models.TextField(db_comment='Frage')
|
question = models.TextField(db_comment="Frage")
|
||||||
active = models.CharField(max_length=1)
|
active = models.CharField(max_length=1)
|
||||||
description = models.CharField(max_length=1)
|
description = models.CharField(max_length=1)
|
||||||
ref_q_id = models.IntegerField(blank=True, null=True)
|
reference_question = models.ForeignKey(
|
||||||
translationstatus = models.IntegerField(blank=True, null=True)
|
"Question",
|
||||||
|
related_name="referenced",
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
translation_status = models.IntegerField(blank=True, null=True)
|
||||||
|
explanation = models.TextField(blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'questions'
|
verbose_name = "Question"
|
||||||
db_table_comment = 'Fragen'
|
|
||||||
|
|
||||||
|
|
||||||
class QuestionDescription(models.Model):
|
|
||||||
q_id = models.IntegerField(primary_key=True)
|
|
||||||
description = models.TextField()
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'question_description'
|
|
||||||
|
|
||||||
|
|
||||||
class Answer(models.Model):
|
class Answer(models.Model):
|
||||||
q_id = models.IntegerField()
|
question = models.ForeignKey(Question, on_delete=models.CASCADE)
|
||||||
answer = models.TextField()
|
answer = models.TextField()
|
||||||
correct = models.IntegerField()
|
correct = models.BooleanField(default=False)
|
||||||
ref_a_id = models.IntegerField(blank=True, null=True)
|
reference_answer = models.ForeignKey(
|
||||||
|
"Answer",
|
||||||
class Meta:
|
related_name="referenced",
|
||||||
db_table = 'answers'
|
on_delete=models.CASCADE,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class User(models.Model):
|
class User(models.Model):
|
||||||
user_id = models.CharField(primary_key=True, max_length=10) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
user_id = models.CharField(
|
||||||
cn_name = models.CharField(db_column='CN_name', max_length=100) # Field name made lowercase.
|
primary_key=True, max_length=10
|
||||||
|
) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
||||||
|
cn_name = models.CharField(
|
||||||
|
db_column="CN_name", max_length=100
|
||||||
|
) # Field name made lowercase.
|
||||||
lang = models.CharField(max_length=2)
|
lang = models.CharField(max_length=2)
|
||||||
admin = models.CharField(max_length=1)
|
admin = models.CharField(max_length=1)
|
||||||
email = models.CharField(max_length=100)
|
email = models.CharField(max_length=100)
|
||||||
sendcert = models.CharField(db_column='sendCert', max_length=13) # Field name made lowercase.
|
send_certificate = models.CharField(
|
||||||
|
db_column="sendCert", max_length=13
|
||||||
|
) # Field name made lowercase.
|
||||||
root = models.CharField(max_length=45)
|
root = models.CharField(max_length=45)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'user'
|
unique_together = (("user_id", "root"),)
|
||||||
unique_together = (('user_id', 'root'),)
|
|
||||||
|
|
||||||
|
|
||||||
class UserAddress(models.Model):
|
class UserAddress(models.Model):
|
||||||
user_id = models.CharField(primary_key=True, max_length=10) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
user_id = models.CharField(
|
||||||
|
primary_key=True, max_length=10
|
||||||
|
) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
||||||
root = models.CharField(max_length=45)
|
root = models.CharField(max_length=45)
|
||||||
firstname = models.CharField(max_length=25)
|
firstname = models.CharField(max_length=25)
|
||||||
lastname = models.CharField(max_length=25)
|
lastname = models.CharField(max_length=25)
|
||||||
street = models.CharField(max_length=50)
|
street = models.CharField(max_length=50)
|
||||||
housenumber = models.CharField(max_length=5)
|
house_number = models.CharField(max_length=5)
|
||||||
zipcode = models.CharField(max_length=10)
|
zipcode = models.CharField(max_length=10)
|
||||||
city = models.CharField(max_length=30)
|
city = models.CharField(max_length=30)
|
||||||
state = models.CharField(max_length=50)
|
state = models.CharField(max_length=50)
|
||||||
country = models.CharField(max_length=50)
|
country = models.CharField(max_length=50)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'user_address'
|
unique_together = (("user_id", "root"),)
|
||||||
unique_together = (('user_id', 'root'),)
|
|
||||||
|
|
||||||
|
|
||||||
class LearnProgress(models.Model):
|
class LearnProgress(models.Model):
|
||||||
user_id = models.CharField(max_length=15)
|
user_id = models.CharField(max_length=15)
|
||||||
root = models.CharField(max_length=45)
|
root = models.CharField(max_length=45)
|
||||||
date = models.DateTimeField(db_comment='Uhrzeit und Datum')
|
date = models.DateTimeField(db_comment="Uhrzeit und Datum")
|
||||||
t_id = models.IntegerField(db_comment='Themen ID')
|
t_id = models.IntegerField(db_comment="Themen ID")
|
||||||
number = models.IntegerField(db_comment='Anzahl der Fragen')
|
number = models.IntegerField(db_comment="Anzahl der Fragen")
|
||||||
correct = models.IntegerField(db_comment='Richtige Fragen')
|
correct = models.IntegerField(db_comment="Richtige Fragen")
|
||||||
wrong = models.IntegerField(db_comment='Anzahl der falschen Antworten')
|
wrong = models.IntegerField(db_comment="Anzahl der falschen Antworten")
|
||||||
percentage = models.DecimalField(max_digits=5, decimal_places=0, blank=True, null=True)
|
percentage = models.DecimalField(
|
||||||
|
max_digits=5, decimal_places=0, blank=True, null=True
|
||||||
|
)
|
||||||
uploaded = models.IntegerField(blank=True, null=True)
|
uploaded = models.IntegerField(blank=True, null=True)
|
||||||
passed = models.IntegerField()
|
passed = models.IntegerField()
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'learnprogress'
|
|
||||||
|
|
||||||
|
|
||||||
class IncorrectAnswer(models.Model):
|
class IncorrectAnswer(models.Model):
|
||||||
lp_id = models.IntegerField(primary_key=True) # The composite primary key (lp_id, q_id) found, that is not supported. The first column is selected.
|
lp_id = models.IntegerField(
|
||||||
|
primary_key=True
|
||||||
|
) # The composite primary key (lp_id, q_id) found, that is not supported. The first column is selected.
|
||||||
q_id = models.IntegerField()
|
q_id = models.IntegerField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'answers_incorrect'
|
unique_together = (("lp_id", "q_id"),)
|
||||||
unique_together = (('lp_id', 'q_id'),)
|
|
||||||
|
|
||||||
|
|
||||||
class SchemaVersion(models.Model):
|
class SchemaVersion(models.Model):
|
||||||
version = models.IntegerField(unique=True)
|
version = models.IntegerField(unique=True)
|
||||||
when = models.DateTimeField()
|
when = models.DateTimeField()
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'schema_version'
|
|
||||||
|
|
||||||
|
|
||||||
class Statistics(models.Model):
|
class Statistics(models.Model):
|
||||||
q_id = models.IntegerField(db_comment='Frage Id')
|
q_id = models.IntegerField(db_comment="Frage Id")
|
||||||
count = models.IntegerField(db_comment='Zählen von Antworten')
|
count = models.IntegerField(db_comment="Zählen von Antworten")
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'statistics'
|
|
||||||
|
|
||||||
|
|
||||||
class Temp(models.Model):
|
class Temp(models.Model):
|
||||||
uid = models.CharField(max_length=10, blank=True, null=True)
|
uid = models.CharField(max_length=10, blank=True, null=True)
|
||||||
number = models.IntegerField(blank=True, null=True)
|
number = models.IntegerField(blank=True, null=True)
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = 'temp'
|
|
||||||
|
|
Loading…
Reference in a new issue