# Path: boardinghouse/base.py
# class SharedSchemaModel(SharedSchemaMixin, models.Model):
#     """
#     A Base class for models that should be in the shared schema.
# 
#     You should inherit from this class if your model _must_ be in
#     the shared schema. Just setting the `_is_shared_model` attribute
#     will not be picked up for migrations.
#     """
# 
#     class Meta:
#         abstract = True
# 
# class MultiSchemaManager(MultiSchemaMixin, models.Manager):
#     """
#     A Manager that allows for fetching objects from multiple schemata
#     in the one request.
#     """


from django.db import models
from django.contrib.auth.models import User  # NOQA
from boardinghouse.base import SharedSchemaModel, MultiSchemaManager
class NaiveModel(SharedSchemaModel):
    name = models.CharField(max_length=10, unique=True)
    status = models.BooleanField(default=False)


# The existence of this model, although it may not have tests
# that apply to it, is enough to trigger infinite recursion if
# a check for self-referencing models is not made in is_shared_model()
class SelfReferentialModel(models.Model):
    name = models.CharField(max_length=10, unique=True)
    parent = models.ForeignKey('tests.SelfReferentialModel',
                               on_delete=models.CASCADE,
                               related_name='children',
                               null=True, blank=True)


# If you have two models that _only_ have foreign keys, and they happen
# to include references to one another, then you could get an infinite
# recursion. However, I can't see that this model structure makes sense.
class CoReferentialModelA(models.Model):
    name = models.CharField(max_length=10, unique=True)
    other = models.ForeignKey('tests.CoReferentialModelB',
                              on_delete=models.CASCADE,
                              related_name='model_a',
                              null=True, blank=True)


class CoReferentialModelB(models.Model):
    name = models.CharField(max_length=10, unique=True)
    other = models.ForeignKey('tests.CoReferentialModelA',

# Path: boardinghouse/base.py
# class SharedSchemaModel(SharedSchemaMixin, models.Model):
#     """
#     A Base class for models that should be in the shared schema.
# 
#     You should inherit from this class if your model _must_ be in
#     the shared schema. Just setting the `_is_shared_model` attribute
#     will not be picked up for migrations.
#     """
# 
#     class Meta:
#         abstract = True
# 
# class MultiSchemaManager(MultiSchemaMixin, models.Manager):
#     """
#     A Manager that allows for fetching objects from multiple schemata
#     in the one request.
#     """


# Path: tests/models.py
from django.db import models
from django.contrib.auth.models import User  # NOQA
from boardinghouse.base import SharedSchemaModel, MultiSchemaManager

class NaiveModel(SharedSchemaModel):
    name = models.CharField(max_length=10, unique=True)
    status = models.BooleanField(default=False)


# The existence of this model, although it may not have tests
# that apply to it, is enough to trigger infinite recursion if
# a check for self-referencing models is not made in is_shared_model()
class SelfReferentialModel(models.Model):
    name = models.CharField(max_length=10, unique=True)
    parent = models.ForeignKey('tests.SelfReferentialModel',
                               on_delete=models.CASCADE,
                               related_name='children',
                               null=True, blank=True)


# If you have two models that _only_ have foreign keys, and they happen
# to include references to one another, then you could get an infinite
# recursion. However, I can't see that this model structure makes sense.
class CoReferentialModelA(models.Model):
    name = models.CharField(max_length=10, unique=True)
    other = models.ForeignKey('tests.CoReferentialModelB',
                              on_delete=models.CASCADE,
                              related_name='model_a',
                              null=True, blank=True)


class CoReferentialModelB(models.Model):
    name = models.CharField(max_length=10, unique=True)
    other = models.ForeignKey('tests.CoReferentialModelA',

                              on_delete=models.CASCADE,