diff --git a/app/models/base.py b/app/models/base.py index eb78608535b8b230da8899b769d4ddada0418788..529e2b8a7a5d40f2100e88c7536baf923a92792a 100644 --- a/app/models/base.py +++ b/app/models/base.py @@ -97,7 +97,7 @@ class External(object): columns.GUID(), index=True, nullable=False, default=uuid.uuid4) -class ProjectSchema(object): +class ProjectSchema(BaseModel): """A mixin that changes the schema to project_service""" @declared_attr @@ -107,7 +107,7 @@ class ProjectSchema(object): """ return cls.__name__.lower() - __table_args__= {"schema": "project_service"} + __table_args__ = {"schema": "project_service"} def __str__(self): """Provide a sane default for model string representation.""" diff --git a/app/models/document.py b/app/models/document.py index 5dba75865e10a6bacd77b8a1fa2408de42833b7c..b604dc424238fd80da262875afa3686dd5de17ab 100644 --- a/app/models/document.py +++ b/app/models/document.py @@ -9,7 +9,7 @@ class DocumentSlot(ProjectSchema, Tracked, db.Model): the document service). """ project_id = db.Column( - db.Integer, db.ForeignKey('project.id'), nullable=False) + db.Integer, db.ForeignKey('project_service.project.id'), nullable=False) document_key = db.Column(GUID(), nullable=False) # How the document fits into the project. diff --git a/app/models/project.py b/app/models/project.py index a8ed55fb314e0d3413b1f73ebc32568a24c0e5ce..7b71df11ae530b8dbf395831ad2db79a04117837 100644 --- a/app/models/project.py +++ b/app/models/project.py @@ -75,7 +75,7 @@ class Project(ProjectSchema, Tracked, SalesForce, db.Model): class ProjectStateChange(ProjectSchema, Tracked, db.Model): """A state change of a project.""" project_id = db.Column( - db.Integer, db.ForeignKey('project.id'), + db.Integer, db.ForeignKey('project_service.project.id'), nullable=False) state = db.Column( db.Enum(*Project.states, name='project_states', inherit_schema=True), diff --git a/wsgi.py b/wsgi.py index d147c76628e5663775b65db95241715368391318..294e9eb1abfaa5e3fbedf6ca944c8b041490d65a 100644 --- a/wsgi.py +++ b/wsgi.py @@ -9,6 +9,3 @@ env = os.environ['ENVIRONMENT'] # Correctly raise a file not found if the specified environment does not exist. app = create_app('config/{}.py'.format(env)) -with app.app_context(): - # Build the database models. - db.create_all()