Column("id", Integer, primary_key=True),
    Column("dataset_id", Integer, ForeignKey("dataset.id"), index=True),
    Column("create_time", DateTime, default=now),
    Column("update_time", DateTime, default=now, onupdate=now),
    Column("copied_from_history_dataset_association_id",
           Integer,
           ForeignKey("history_dataset_association.id"),
           nullable=True),
    Column("copied_from_library_dataset_dataset_association_id",
           Integer,
           ForeignKey("library_dataset_dataset_association.id"),
           nullable=True), Column("hid", Integer),
    Column("name", TrimmedString(255)), Column("info", TrimmedString(255)),
    Column("blurb", TrimmedString(255)), Column("peek", TEXT),
    Column("extension", TrimmedString(64)),
    Column("metadata", MetadataType(), key="_metadata"),
    Column("parent_id",
           Integer,
           ForeignKey("history_dataset_association.id"),
           nullable=True), Column("designation", TrimmedString(255)),
    Column("deleted", Boolean, index=True, default=False),
    Column("visible", Boolean))

LibraryDatasetDatasetAssociation.table = Table(
    "library_dataset_dataset_association", metadata,
    Column("id", Integer, primary_key=True),
    Column("library_dataset_id",
           Integer,
           ForeignKey("library_dataset.id"),
           index=True),
    Column("dataset_id", Integer, ForeignKey("dataset.id"), index=True),
Exemplo n.º 2
0
log.setLevel(logging.DEBUG)
metadata = MetaData()

HistoryDatasetAssociationHistory_table = Table(
    "history_dataset_association_history",
    metadata,
    Column("id", Integer, primary_key=True),
    Column("history_dataset_association_id",
           Integer,
           ForeignKey("history_dataset_association.id"),
           index=True),
    Column("update_time", DateTime, default=now),
    Column("version", Integer, index=True),
    Column("name", TrimmedString(255)),
    Column("extension", TrimmedString(64)),
    Column("metadata", MetadataType(), key='_metadata'),
    Column("extended_metadata_id",
           Integer,
           ForeignKey("extended_metadata.id"),
           index=True),
)


def upgrade(migrate_engine):
    print(__doc__)
    metadata.bind = migrate_engine
    metadata.reflect()
    try:
        HistoryDatasetAssociationHistory_table.create()
        log.debug("Created history_dataset_association_history table")
    except Exception: