remove workspaces task order association for now
This commit is contained in:
parent
ef153f5226
commit
75f41d4d2b
@ -0,0 +1,30 @@
|
|||||||
|
"""remove workspaces task order association
|
||||||
|
|
||||||
|
Revision ID: f549c7cee17c
|
||||||
|
Revises: 4be312655ceb
|
||||||
|
Create Date: 2018-08-16 16:42:48.581510
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'f549c7cee17c'
|
||||||
|
down_revision = '4be312655ceb'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint('workspaces_task_order_id_fkey', 'workspaces', type_='foreignkey')
|
||||||
|
op.drop_column('workspaces', 'task_order_id')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('workspaces', sa.Column('task_order_id', sa.INTEGER(), autoincrement=False, nullable=False))
|
||||||
|
op.create_foreign_key('workspaces_task_order_id_fkey', 'workspaces', 'task_order', ['task_order_id'], ['id'])
|
||||||
|
# ### end Alembic commands ###
|
@ -11,9 +11,9 @@ class Workspaces(object):
|
|||||||
# workspace_roles table?
|
# workspace_roles table?
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, request, task_order, name=None):
|
def create(cls, request, name=None):
|
||||||
name = name or request.id
|
name = name or request.id
|
||||||
return Workspace(request=request, task_order=task_order, name=name)
|
return Workspace(request=request, name=name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, workspace_id):
|
def get(cls, workspace_id):
|
||||||
|
@ -13,7 +13,4 @@ class Workspace(Base):
|
|||||||
request_id = Column(ForeignKey("requests.id"), nullable=False)
|
request_id = Column(ForeignKey("requests.id"), nullable=False)
|
||||||
request = relationship("Request")
|
request = relationship("Request")
|
||||||
|
|
||||||
task_order_id = Column(ForeignKey("task_order.id"), nullable=False)
|
|
||||||
task_order = relationship("TaskOrder")
|
|
||||||
|
|
||||||
name = Column(String, unique=True)
|
name = Column(String, unique=True)
|
||||||
|
@ -9,13 +9,11 @@ from tests.factories import WorkspaceFactory, RequestFactory, TaskOrderFactory
|
|||||||
|
|
||||||
def test_can_create_workspace():
|
def test_can_create_workspace():
|
||||||
request = RequestFactory.create()
|
request = RequestFactory.create()
|
||||||
to = TaskOrderFactory.create()
|
workspace = Workspaces.create(request)
|
||||||
workspace = Workspaces.create(request, to)
|
|
||||||
assert workspace.request == request
|
assert workspace.request == request
|
||||||
assert workspace.task_order == to
|
|
||||||
assert workspace.name == request.id
|
assert workspace.name == request.id
|
||||||
|
|
||||||
workspace = Workspaces.create(request, to, name="frugal-whale")
|
workspace = Workspaces.create(request, name="frugal-whale")
|
||||||
assert workspace.name == "frugal-whale"
|
assert workspace.name == "frugal-whale"
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,6 +110,5 @@ class WorkspaceFactory(factory.alchemy.SQLAlchemyModelFactory):
|
|||||||
model = Workspace
|
model = Workspace
|
||||||
|
|
||||||
request = factory.SubFactory(RequestFactory)
|
request = factory.SubFactory(RequestFactory)
|
||||||
task_order = factory.SubFactory(TaskOrderFactory)
|
|
||||||
# name it the same as the request ID by default
|
# name it the same as the request ID by default
|
||||||
name = factory.LazyAttribute(lambda w: w.request.id)
|
name = factory.LazyAttribute(lambda w: w.request.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user