Skip to content

Commit

Permalink
fix tests. Probably should start using prs to test these things
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Oct 19, 2017
1 parent 41703d9 commit 227b649
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ def upgrade():
sa.Column('name', sa.String, nullable=False),
sa.Column('tags', HSTORE),
sa.Column('state', sa.Enum(InstanceState), default=InstanceState.BUILDING, nullable=False),
sa.Column('network_port_id', sau.UUIDType, sa.ForeignKey('network_ports.id', ondelete='RESTRICT')),

sa.Column('project_id', sau.UUIDType, sa.ForeignKey('projects.id', ondelete='RESTRICT'), nullable=False),
sa.Column('current_task_id', sau.UUIDType, sa.ForeignKey('tasks.id')),
sa.Column('image_id', sau.UUIDType, sa.ForeignKey('images.id', ondelete='SET NULL')),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False, index=True),
sa.Column('updated_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(),
nullable=False),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def upgrade():

sa.Column('project_id', sau.UUIDType, sa.ForeignKey('projects.id', ondelete='RESTRICT'), nullable=False),
sa.Column('current_task_id', sau.UUIDType, sa.ForeignKey('tasks.id')),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False, index=True),
sa.Column('updated_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(),
nullable=False),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def upgrade():
sa.Column('cidr', IPv4Network, nullable=False),
sa.Column('pool_start', sau.IPAddressType, nullable=False),
sa.Column('pool_end', sau.IPAddressType, nullable=False),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False),
sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False, index=True),
sa.Column('updated_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(),
nullable=False),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def upgrade():
sa.Column('token_id', sau.UUIDType, sa.ForeignKey('authn_tokens.id', ondelete='CASCADE'), nullable=False),
sa.Column('role_id', sau.UUIDType, sa.ForeignKey('authz_roles.id', ondelete='CASCADE'), nullable=False),

sa.Column('created_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), nullable=False, index=True),
sa.Column('updated_at', sau.ArrowType(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(),
nullable=False),
)
Expand Down
7 changes: 4 additions & 3 deletions ingredients_db/models/public_key.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from sqlalchemy import text, Column, String, Text, func
from sqlalchemy import text, Column, String, Text, func, ForeignKey
from sqlalchemy_utils import UUIDType, generic_repr, ArrowType

from ingredients_db.database import Base
from ingredients_db.models.project import ProjectMixin


@generic_repr
class PublicKey(Base, ProjectMixin):
class PublicKey(Base):
__tablename__ = 'public_keys'

id = Column(UUIDType, server_default=text("uuid_generate_v4()"), primary_key=True)
name = Column(String, nullable=False)
key = Column(Text, nullable=False)

project_id = Column(UUIDType, ForeignKey('projects.id', ondelete='CASCADE'), nullable=False)

created_at = Column(ArrowType(timezone=True), server_default=func.now(), nullable=False)
updated_at = Column(ArrowType(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)

0 comments on commit 227b649

Please sign in to comment.