@@ -279,6 +279,7 @@ class Study(BaseMixin, db.Model):
279279 level = db .Column (db .String )
280280 metadata_ = db .Column (JSONB )
281281 source = db .Column (db .String , index = True )
282+ base_study_id = db .Column (db .Text , db .ForeignKey ("base_studies.id" ), index = True )
282283 source_id = db .Column (db .String , index = True )
283284 source_updated_at = db .Column (db .DateTime (timezone = True ))
284285 base_study_id = db .Column (db .Text , db .ForeignKey ("base_studies.id" ), index = True )
@@ -538,6 +539,75 @@ class PointValue(BaseMixin, db.Model):
538539 user = relationship ("User" , backref = backref ("point_values" , passive_deletes = True ))
539540
540541
542+ class Pipeline (BaseMixin , db .Model ):
543+ __tablename__ = "pipelines"
544+
545+ name = db .Column (db .String )
546+ description = db .Column (db .String )
547+ version = db .Column (db .String )
548+ study_dependent = db .Column (db .Boolean , default = False )
549+ ace_compatible = db .Column (db .Boolean , default = False )
550+ pubget_compatible = db .Column (db .Boolean , default = False )
551+ derived_from = db .Column (db .Text )
552+
553+
554+ class PipelineConfig (BaseMixin , db .Model ):
555+ __tablename__ = "pipeline_configs"
556+
557+ pipeline_id = db .Column (
558+ db .Text , db .ForeignKey ("pipelines.id" , ondelete = "CASCADE" ), index = True
559+ )
560+ config = db .Column (JSONB )
561+ config_hash = db .Column (db .String , index = True )
562+ pipeline = relationship (
563+ "Pipeline" , backref = backref ("configs" , passive_deletes = True )
564+ )
565+
566+
567+ class PipelineRun (BaseMixin , db .Model ):
568+ __tablename__ = "pipeline_runs"
569+
570+ pipeline_id = db .Column (
571+ db .Text , db .ForeignKey ("pipelines.id" , ondelete = "CASCADE" ), index = True
572+ )
573+ config_id = db .Column (
574+ db .Text , db .ForeignKey ("pipeline_configs.id" , ondelete = "CASCADE" ), index = True
575+ )
576+ config = relationship (
577+ "PipelineConfig" , backref = backref ("runs" , passive_deletes = True )
578+ )
579+ run_index = db .Column (db .Integer ())
580+
581+
582+ class PipelineRunResult (BaseMixin , db .Model ):
583+ __tablename__ = "pipeline_run_results"
584+
585+ run_id = db .Column (
586+ db .Text , db .ForeignKey ("pipeline_runs.id" , ondelete = "CASCADE" ), index = True
587+ )
588+ base_study_id = db .Column (db .Text , db .ForeignKey ("base_studies.id" ), index = True )
589+ date_executed = db .Column (db .DateTime (timezone = True ))
590+ data = db .Column (JSONB )
591+ file_inputs = db .Column (JSONB )
592+ run = relationship ("PipelineRun" , backref = backref ("results" , passive_deletes = True ))
593+
594+
595+ class PipelineRunResultVote (BaseMixin , db .Model ):
596+ __tablename__ = "pipeline_run_result_votes"
597+
598+ run_result_id = db .Column (
599+ db .Text ,
600+ db .ForeignKey ("pipeline_run_results.id" , ondelete = "CASCADE" ),
601+ index = True ,
602+ )
603+ user_id = db .Column (db .Text , db .ForeignKey ("users.external_id" ), index = True )
604+ accurate = db .Column (db .Boolean )
605+ run_result = relationship (
606+ "PipelineRunResult" , backref = backref ("votes" , passive_deletes = True )
607+ )
608+ user = relationship ("User" , backref = backref ("votes" , passive_deletes = True ))
609+
610+
541611# from . import event_listeners # noqa E402
542612
543613# del event_listeners
0 commit comments