Skip to content

Commit

Permalink
Start trimming model definition syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Mar 8, 2024
1 parent 9e92998 commit 500675f
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,11 @@ class WorkerProcess(Base, UsesCreateAndUpdateTime):
__tablename__ = "worker_process"
__table_args__ = (UniqueConstraint("server_name", "hostname"),)

id: Mapped[int] = mapped_column(Integer, primary_key=True)
id: Mapped[int] = mapped_column(primary_key=True)
server_name: Mapped[Optional[str]] = mapped_column(String(255), index=True)
hostname: Mapped[Optional[str]] = mapped_column(String(255))
pid: Mapped[Optional[int]] = mapped_column(Integer)
update_time: Mapped[Optional[datetime]] = mapped_column(DateTime, default=now, onupdate=now)
pid: Mapped[Optional[int]]
update_time: Mapped[Optional[datetime]] = mapped_column(default=now, onupdate=now)


def cached_id(galaxy_model_object):
Expand Down Expand Up @@ -674,21 +674,21 @@ class User(Base, Dictifiable, RepresentById):

__tablename__ = "galaxy_user"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
create_time: Mapped[datetime] = mapped_column(DateTime, default=now, nullable=True)
update_time: Mapped[datetime] = mapped_column(DateTime, default=now, onupdate=now, nullable=True)
id: Mapped[int] = mapped_column(primary_key=True)
create_time: Mapped[datetime] = mapped_column(default=now, nullable=True)
update_time: Mapped[datetime] = mapped_column(default=now, onupdate=now, nullable=True)
email: Mapped[str] = mapped_column(TrimmedString(255), index=True, nullable=False)
username: Mapped[Optional[str]] = mapped_column(TrimmedString(255), index=True, unique=True)
password: Mapped[str] = mapped_column(TrimmedString(255), nullable=False)
last_password_change: Mapped[Optional[datetime]] = mapped_column(DateTime, default=now)
external: Mapped[Optional[bool]] = mapped_column(Boolean, default=False)
form_values_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("form_values.id"), index=True)
last_password_change: Mapped[Optional[datetime]] = mapped_column(default=now)
external: Mapped[Optional[bool]] = mapped_column(default=False)
form_values_id: Mapped[Optional[int]] = mapped_column(ForeignKey("form_values.id"), index=True)
preferred_object_store_id: Mapped[str] = mapped_column(String(255), nullable=True)
deleted: Mapped[Optional[bool]] = mapped_column(Boolean, index=True, default=False)
purged: Mapped[Optional[bool]] = mapped_column(Boolean, index=True, default=False)
deleted: Mapped[Optional[bool]] = mapped_column(index=True, default=False)
purged: Mapped[Optional[bool]] = mapped_column(index=True, default=False)
disk_usage: Mapped[Optional[Decimal]] = mapped_column(Numeric(15, 0), index=True)
# Column("person_metadata", JSONType), # TODO: add persistent, configurable metadata rep for workflow creator
active: Mapped[bool] = mapped_column(Boolean, index=True, default=True, nullable=False)
active: Mapped[bool] = mapped_column(index=True, default=True, nullable=False)
activation_token: Mapped[Optional[str]] = mapped_column(TrimmedString(64), nullable=True, index=True)

addresses: Mapped[List["UserAddress"]] = relationship(
Expand Down Expand Up @@ -1215,8 +1215,8 @@ class PasswordResetToken(Base):
__tablename__ = "password_reset_token"

token: Mapped[str] = mapped_column(String(32), primary_key=True, unique=True, index=True)
expiration_time: Mapped[Optional[datetime]] = mapped_column(DateTime)
user_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("galaxy_user.id"), index=True)
expiration_time: Mapped[Optional[datetime]]
user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("galaxy_user.id"), index=True)
user: Mapped["User"] = relationship("User")

def __init__(self, user, token=None):
Expand All @@ -1231,17 +1231,17 @@ def __init__(self, user, token=None):
class DynamicTool(Base, Dictifiable, RepresentById):
__tablename__ = "dynamic_tool"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
id: Mapped[int] = mapped_column(primary_key=True)
uuid: Mapped[Optional[Union[UUID, str]]] = mapped_column(UUIDType())
create_time: Mapped[datetime] = mapped_column(DateTime, default=now, nullable=True)
update_time: Mapped[datetime] = mapped_column(DateTime, index=True, default=now, onupdate=now, nullable=True)
create_time: Mapped[datetime] = mapped_column(default=now, nullable=True)
update_time: Mapped[datetime] = mapped_column(index=True, default=now, onupdate=now, nullable=True)
tool_id: Mapped[Optional[str]] = mapped_column(Unicode(255))
tool_version: Mapped[Optional[str]] = mapped_column(Unicode(255))
tool_format: Mapped[Optional[str]] = mapped_column(Unicode(255))
tool_path: Mapped[Optional[str]] = mapped_column(Unicode(255))
tool_directory: Mapped[Optional[str]] = mapped_column(Unicode(255))
hidden: Mapped[Optional[bool]] = mapped_column(Boolean, default=True)
active: Mapped[Optional[bool]] = mapped_column(Boolean, default=True)
hidden: Mapped[Optional[bool]] = mapped_column(default=True)
active: Mapped[Optional[bool]] = mapped_column(default=True)
value: Mapped[Optional[bytes]] = mapped_column(MutableJSONType)

dict_collection_visible_keys = ("id", "tool_id", "tool_format", "tool_version", "uuid", "active", "hidden")
Expand All @@ -1268,8 +1268,8 @@ def __init__(self, plugin, metric_name, metric_value):
class JobMetricText(BaseJobMetric, RepresentById):
__tablename__ = "job_metric_text"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
job_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("job.id"), index=True)
id: Mapped[int] = mapped_column(primary_key=True)
job_id: Mapped[Optional[int]] = mapped_column(ForeignKey("job.id"), index=True)
plugin: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_name: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_value: Mapped[Optional[str]] = mapped_column(Unicode(JOB_METRIC_MAX_LENGTH))
Expand All @@ -1278,8 +1278,8 @@ class JobMetricText(BaseJobMetric, RepresentById):
class JobMetricNumeric(BaseJobMetric, RepresentById):
__tablename__ = "job_metric_numeric"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
job_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("job.id"), index=True)
id: Mapped[int] = mapped_column(primary_key=True)
job_id: Mapped[Optional[int]] = mapped_column(ForeignKey("job.id"), index=True)
plugin: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_name: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(JOB_METRIC_PRECISION, JOB_METRIC_SCALE))
Expand All @@ -1288,8 +1288,8 @@ class JobMetricNumeric(BaseJobMetric, RepresentById):
class TaskMetricText(BaseJobMetric, RepresentById):
__tablename__ = "task_metric_text"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
task_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("task.id"), index=True)
id: Mapped[int] = mapped_column(primary_key=True)
task_id: Mapped[Optional[int]] = mapped_column(ForeignKey("task.id"), index=True)
plugin: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_name: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_value: Mapped[Optional[str]] = mapped_column(Unicode(JOB_METRIC_MAX_LENGTH))
Expand All @@ -1298,8 +1298,8 @@ class TaskMetricText(BaseJobMetric, RepresentById):
class TaskMetricNumeric(BaseJobMetric, RepresentById):
__tablename__ = "task_metric_numeric"

id: Mapped[int] = mapped_column(Integer, primary_key=True)
task_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("task.id"), index=True)
id: Mapped[int] = mapped_column(primary_key=True)
task_id: Mapped[Optional[int]] = mapped_column(ForeignKey("task.id"), index=True)
plugin: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_name: Mapped[Optional[str]] = mapped_column(Unicode(255))
metric_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(JOB_METRIC_PRECISION, JOB_METRIC_SCALE))
Expand Down

0 comments on commit 500675f

Please sign in to comment.