Introduce primary keys and remove managed = False from models

(Assuming we want to manage these tables using django in future)
This commit is contained in:
PCoder 2021-07-27 09:38:39 +05:30
parent a6f2fe912d
commit 223b2650ad

View file

@ -17,43 +17,41 @@ class AlembicVersion(models.Model):
class Field(models.Model): class Field(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
name = models.CharField(blank=True, null=True) name = models.CharField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'field' db_table = 'field'
class FieldsPeople(models.Model): class FieldsPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True)
field = models.ForeignKey(Field, models.DO_NOTHING, blank=True, null=True) field = models.ForeignKey(Field, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'fields_people' db_table = 'fields_people'
class Method(models.Model): class Method(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
name = models.CharField(blank=True, null=True) name = models.CharField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'method' db_table = 'method'
class MethodsPeople(models.Model): class MethodsPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True)
method = models.ForeignKey(Method, models.DO_NOTHING, blank=True, null=True) method = models.ForeignKey(Method, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'methods_people' db_table = 'methods_people'
class Person(models.Model): class Person(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
source_id = models.IntegerField(blank=True, null=True) source_id = models.IntegerField(blank=True, null=True)
title = models.CharField(blank=True, null=True) title = models.CharField(blank=True, null=True)
first_name = models.CharField(blank=True, null=True) first_name = models.CharField(blank=True, null=True)
@ -67,33 +65,31 @@ class Person(models.Model):
field_indexer = models.TextField(db_column='_indexer', blank=True, null=True) # Field renamed because it started with '_'. field_indexer = models.TextField(db_column='_indexer', blank=True, null=True) # Field renamed because it started with '_'.
class Meta: class Meta:
managed = False
db_table = 'person' db_table = 'person'
class Range(models.Model): class Range(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
source_id = models.IntegerField(blank=True, null=True) source_id = models.IntegerField(blank=True, null=True)
gmba_id = models.CharField(blank=True, null=True) gmba_id = models.CharField(blank=True, null=True)
name = models.CharField(blank=True, null=True) name = models.CharField(blank=True, null=True)
countries = models.CharField(blank=True, null=True) countries = models.CharField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'range' db_table = 'range'
class RangesPeople(models.Model): class RangesPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True) range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'ranges_people' db_table = 'ranges_people'
class Resource(models.Model): class Resource(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
source_id = models.IntegerField(blank=True, null=True) source_id = models.IntegerField(blank=True, null=True)
title = models.CharField(blank=True, null=True) title = models.CharField(blank=True, null=True)
url = models.CharField(blank=True, null=True) url = models.CharField(blank=True, null=True)
@ -101,50 +97,47 @@ class Resource(models.Model):
abstract = models.TextField(blank=True, null=True) abstract = models.TextField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'resource' db_table = 'resource'
class ResourcesPeople(models.Model): class ResourcesPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'resources_people' db_table = 'resources_people'
class Scale(models.Model): class Scale(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
name = models.CharField(blank=True, null=True) name = models.CharField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'scale' db_table = 'scale'
class ScalesPeople(models.Model): class ScalesPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
scale = models.ForeignKey(Scale, models.DO_NOTHING, blank=True, null=True) scale = models.ForeignKey(Scale, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'scales_people' db_table = 'scales_people'
class TaxaPeople(models.Model): class TaxaPeople(models.Model):
id = models.AutoField(primary_key=True)
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
taxon = models.ForeignKey('Taxon', models.DO_NOTHING, blank=True, null=True) taxon = models.ForeignKey('Taxon', models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'taxa_people' db_table = 'taxa_people'
class Taxon(models.Model): class Taxon(models.Model):
id = models.AutoField() id = models.AutoField(primary_key=True)
name = models.CharField(blank=True, null=True) name = models.CharField(blank=True, null=True)
class Meta: class Meta:
managed = False
db_table = 'taxon' db_table = 'taxon'