PageRenderTime 150ms CodeModel.GetById 34ms app.highlight 104ms RepoModel.GetById 2ms app.codeStats 0ms

/lib/galaxy/model/mapping.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 1910 lines | 1580 code | 266 blank | 64 comment | 6 complexity | 671bc2833c7941cf78847d9c8f1d10bd MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1"""
  2Details of how the data model objects are mapped onto the relational database
  3are encapsulated here.
  4"""
  5
  6import logging
  7import pkg_resources
  8
  9from sqlalchemy import and_, asc, Boolean, Column, DateTime, desc, ForeignKey, Integer, MetaData, not_, Numeric, select, String, Table, TEXT, Unicode, UniqueConstraint
 10from sqlalchemy.ext.associationproxy import association_proxy
 11from sqlalchemy.ext.orderinglist import ordering_list
 12from sqlalchemy.types import BigInteger
 13from sqlalchemy.orm import backref, object_session, relation, mapper, class_mapper
 14from sqlalchemy.orm.collections import attribute_mapped_collection
 15
 16from galaxy import model
 17from galaxy.model.orm.engine_factory import build_engine
 18from galaxy.model.orm.now import now
 19from galaxy.model.custom_types import JSONType, MetadataType, TrimmedString, UUIDType
 20from galaxy.model.base import ModelMapping
 21from galaxy.security import GalaxyRBACAgent
 22
 23log = logging.getLogger( __name__ )
 24
 25metadata = MetaData()
 26
 27
 28model.User.table = Table( "galaxy_user", metadata,
 29    Column( "id", Integer, primary_key=True),
 30    Column( "create_time", DateTime, default=now ),
 31    Column( "update_time", DateTime, default=now, onupdate=now ),
 32    Column( "email", TrimmedString( 255 ), index=True, nullable=False ),
 33    Column( "username", TrimmedString( 255 ), index=True, unique=True ),
 34    Column( "password", TrimmedString( 255 ), nullable=False ),
 35    Column( "external", Boolean, default=False ),
 36    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
 37    Column( "deleted", Boolean, index=True, default=False ),
 38    Column( "purged", Boolean, index=True, default=False ),
 39    Column( "disk_usage", Numeric( 15, 0 ), index=True ) ,
 40    Column( "active", Boolean, index=True, default=True, nullable=False ),
 41    Column( "activation_token", TrimmedString( 64 ), nullable=True, index=True ) )
 42
 43
 44model.UserAddress.table = Table( "user_address", metadata,
 45    Column( "id", Integer, primary_key=True),
 46    Column( "create_time", DateTime, default=now ),
 47    Column( "update_time", DateTime, default=now, onupdate=now ),
 48    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
 49    Column( "desc", TrimmedString( 255 )),
 50    Column( "name", TrimmedString( 255 ), nullable=False),
 51    Column( "institution", TrimmedString( 255 )),
 52    Column( "address", TrimmedString( 255 ), nullable=False),
 53    Column( "city", TrimmedString( 255 ), nullable=False),
 54    Column( "state", TrimmedString( 255 ), nullable=False),
 55    Column( "postal_code", TrimmedString( 255 ), nullable=False),
 56    Column( "country", TrimmedString( 255 ), nullable=False),
 57    Column( "phone", TrimmedString( 255 )),
 58    Column( "deleted", Boolean, index=True, default=False ),
 59    Column( "purged", Boolean, index=True, default=False ) )
 60
 61model.UserOpenID.table = Table( "galaxy_user_openid", metadata,
 62    Column( "id", Integer, primary_key=True ),
 63    Column( "create_time", DateTime, default=now ),
 64    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
 65    Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True ),
 66    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
 67    Column( "openid", TEXT, index=True, unique=True ),
 68    Column( "provider", TrimmedString( 255 ) ),
 69    )
 70
 71model.History.table = Table( "history", metadata,
 72    Column( "id", Integer, primary_key=True),
 73    Column( "create_time", DateTime, default=now ),
 74    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
 75    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
 76    Column( "name", TrimmedString( 255 ) ),
 77    Column( "hid_counter", Integer, default=1 ),
 78    Column( "deleted", Boolean, index=True, default=False ),
 79    Column( "purged", Boolean, index=True, default=False ),
 80    Column( "importing", Boolean, index=True, default=False ),
 81    Column( "genome_build", TrimmedString( 40 ) ),
 82    Column( "importable", Boolean, default=False ),
 83    Column( "slug", TEXT, index=True ),
 84    Column( "published", Boolean, index=True, default=False ) )
 85
 86model.HistoryUserShareAssociation.table = Table( "history_user_share_association", metadata,
 87    Column( "id", Integer, primary_key=True ),
 88    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
 89    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
 90    )
 91
 92model.HistoryDatasetAssociation.table = Table( "history_dataset_association", metadata,
 93    Column( "id", Integer, primary_key=True ),
 94    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
 95    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
 96    Column( "create_time", DateTime, default=now ),
 97    Column( "update_time", DateTime, default=now, onupdate=now ),
 98    Column( "state", TrimmedString( 64 ), index=True, key="_state" ),
 99    Column( "copied_from_history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), nullable=True ),
100    Column( "copied_from_library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), nullable=True ),
101    Column( "hid", Integer ),
102    Column( "name", TrimmedString( 255 ) ),
103    Column( "info", TrimmedString( 255 ) ),
104    Column( "blurb", TrimmedString( 255 ) ),
105    Column( "peek" , TEXT ),
106    Column( "tool_version" , TEXT ),
107    Column( "extension", TrimmedString( 64 ) ),
108    Column( "metadata", MetadataType(), key="_metadata" ),
109    Column( "parent_id", Integer, ForeignKey( "history_dataset_association.id" ), nullable=True ),
110    Column( "designation", TrimmedString( 255 ) ),
111    Column( "deleted", Boolean, index=True, default=False ),
112    Column( "purged", Boolean, index=True, default=False ),
113    Column( "visible", Boolean ),
114    Column( "extended_metadata_id", Integer,
115        ForeignKey( "extended_metadata.id" ), index=True )
116    )
117
118model.Dataset.table = Table( "dataset", metadata,
119    Column( "id", Integer, primary_key=True ),
120    Column( "create_time", DateTime, default=now ),
121    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
122    Column( "state", TrimmedString( 64 ), index=True ),
123    Column( "deleted", Boolean, index=True, default=False ),
124    Column( "purged", Boolean, index=True, default=False ),
125    Column( "purgable", Boolean, default=True ),
126    Column( "object_store_id", TrimmedString( 255 ), index=True ),
127    Column( "external_filename" , TEXT ),
128    Column( "_extra_files_path", TEXT ),
129    Column( 'file_size', Numeric( 15, 0 ) ),
130    Column( 'total_size', Numeric( 15, 0 ) ),
131    Column( 'uuid', UUIDType() ) )
132
133model.HistoryDatasetAssociationDisplayAtAuthorization.table = Table( "history_dataset_association_display_at_authorization", metadata,
134    Column( "id", Integer, primary_key=True ),
135    Column( "create_time", DateTime, default=now ),
136    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
137    Column( "history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
138    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
139    Column( "site", TrimmedString( 255 ) ) )
140
141model.HistoryDatasetAssociationSubset.table = Table( "history_dataset_association_subset", metadata,
142    Column( "id", Integer, primary_key=True ),
143    Column( "history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
144    Column( "history_dataset_association_subset_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
145    Column( "location", Unicode(255), index=True) )
146
147model.ImplicitlyConvertedDatasetAssociation.table = Table( "implicitly_converted_dataset_association", metadata,
148    Column( "id", Integer, primary_key=True ),
149    Column( "create_time", DateTime, default=now ),
150    Column( "update_time", DateTime, default=now, onupdate=now ),
151    Column( "hda_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True, nullable=True ),
152    Column( "ldda_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True, nullable=True ),
153    Column( "hda_parent_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
154    Column( "ldda_parent_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True ),
155    Column( "deleted", Boolean, index=True, default=False ),
156    Column( "metadata_safe", Boolean, index=True, default=True ),
157    Column( "type", TrimmedString( 255 ) ) )
158
159model.ValidationError.table = Table( "validation_error", metadata,
160    Column( "id", Integer, primary_key=True ),
161    Column( "dataset_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
162    Column( "message", TrimmedString( 255 ) ),
163    Column( "err_type", TrimmedString( 64 ) ),
164    Column( "attributes", TEXT ) )
165
166model.Group.table = Table( "galaxy_group", metadata,
167    Column( "id", Integer, primary_key=True ),
168    Column( "create_time", DateTime, default=now ),
169    Column( "update_time", DateTime, default=now, onupdate=now ),
170    Column( "name", String( 255 ), index=True, unique=True ),
171    Column( "deleted", Boolean, index=True, default=False ) )
172
173model.UserGroupAssociation.table = Table( "user_group_association", metadata,
174    Column( "id", Integer, primary_key=True ),
175    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
176    Column( "group_id", Integer, ForeignKey( "galaxy_group.id" ), index=True ),
177    Column( "create_time", DateTime, default=now ),
178    Column( "update_time", DateTime, default=now, onupdate=now ) )
179
180model.UserRoleAssociation.table = Table( "user_role_association", metadata,
181    Column( "id", Integer, primary_key=True ),
182    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
183    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ),
184    Column( "create_time", DateTime, default=now ),
185    Column( "update_time", DateTime, default=now, onupdate=now ) )
186
187model.GroupRoleAssociation.table = Table( "group_role_association", metadata,
188    Column( "id", Integer, primary_key=True ),
189    Column( "group_id", Integer, ForeignKey( "galaxy_group.id" ), index=True ),
190    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ),
191    Column( "create_time", DateTime, default=now ),
192    Column( "update_time", DateTime, default=now, onupdate=now ) )
193
194model.Role.table = Table( "role", metadata,
195    Column( "id", Integer, primary_key=True ),
196    Column( "create_time", DateTime, default=now ),
197    Column( "update_time", DateTime, default=now, onupdate=now ),
198    Column( "name", String( 255 ), index=True, unique=True ),
199    Column( "description", TEXT ),
200    Column( "type", String( 40 ), index=True ),
201    Column( "deleted", Boolean, index=True, default=False ) )
202
203model.UserQuotaAssociation.table = Table( "user_quota_association", metadata,
204    Column( "id", Integer, primary_key=True ),
205    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
206    Column( "quota_id", Integer, ForeignKey( "quota.id" ), index=True ),
207    Column( "create_time", DateTime, default=now ),
208    Column( "update_time", DateTime, default=now, onupdate=now ) )
209
210model.GroupQuotaAssociation.table = Table( "group_quota_association", metadata,
211    Column( "id", Integer, primary_key=True ),
212    Column( "group_id", Integer, ForeignKey( "galaxy_group.id" ), index=True ),
213    Column( "quota_id", Integer, ForeignKey( "quota.id" ), index=True ),
214    Column( "create_time", DateTime, default=now ),
215    Column( "update_time", DateTime, default=now, onupdate=now ) )
216
217model.Quota.table = Table( "quota", metadata,
218    Column( "id", Integer, primary_key=True ),
219    Column( "create_time", DateTime, default=now ),
220    Column( "update_time", DateTime, default=now, onupdate=now ),
221    Column( "name", String( 255 ), index=True, unique=True ),
222    Column( "description", TEXT ),
223    Column( "bytes", BigInteger ),
224    Column( "operation", String( 8 ) ),
225    Column( "deleted", Boolean, index=True, default=False ) )
226
227model.DefaultQuotaAssociation.table = Table( "default_quota_association", metadata,
228    Column( "id", Integer, primary_key=True ),
229    Column( "create_time", DateTime, default=now ),
230    Column( "update_time", DateTime, default=now, onupdate=now ),
231    Column( "type", String( 32 ), index=True, unique=True ),
232    Column( "quota_id", Integer, ForeignKey( "quota.id" ), index=True ) )
233
234model.DatasetPermissions.table = Table( "dataset_permissions", metadata,
235    Column( "id", Integer, primary_key=True ),
236    Column( "create_time", DateTime, default=now ),
237    Column( "update_time", DateTime, default=now, onupdate=now ),
238    Column( "action", TEXT ),
239    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
240    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
241
242model.LibraryPermissions.table = Table( "library_permissions", metadata,
243    Column( "id", Integer, primary_key=True ),
244    Column( "create_time", DateTime, default=now ),
245    Column( "update_time", DateTime, default=now, onupdate=now ),
246    Column( "action", TEXT ),
247    Column( "library_id", Integer, ForeignKey( "library.id" ), nullable=True, index=True ),
248    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
249
250model.LibraryFolderPermissions.table = Table( "library_folder_permissions", metadata,
251    Column( "id", Integer, primary_key=True ),
252    Column( "create_time", DateTime, default=now ),
253    Column( "update_time", DateTime, default=now, onupdate=now ),
254    Column( "action", TEXT ),
255    Column( "library_folder_id", Integer, ForeignKey( "library_folder.id" ), nullable=True, index=True ),
256    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
257
258model.LibraryDatasetPermissions.table = Table( "library_dataset_permissions", metadata,
259    Column( "id", Integer, primary_key=True ),
260    Column( "create_time", DateTime, default=now ),
261    Column( "update_time", DateTime, default=now, onupdate=now ),
262    Column( "action", TEXT ),
263    Column( "library_dataset_id", Integer, ForeignKey( "library_dataset.id" ), nullable=True, index=True ),
264    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
265
266model.LibraryDatasetDatasetAssociationPermissions.table = Table( "library_dataset_dataset_association_permissions", metadata,
267    Column( "id", Integer, primary_key=True ),
268    Column( "create_time", DateTime, default=now ),
269    Column( "update_time", DateTime, default=now, onupdate=now ),
270    Column( "action", TEXT ),
271    Column( "library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), nullable=True, index=True ),
272    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
273
274model.DefaultUserPermissions.table = Table( "default_user_permissions", metadata,
275    Column( "id", Integer, primary_key=True ),
276    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
277    Column( "action", TEXT ),
278    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
279
280model.DefaultHistoryPermissions.table = Table( "default_history_permissions", metadata,
281    Column( "id", Integer, primary_key=True ),
282    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
283    Column( "action", TEXT ),
284    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
285
286model.LibraryDataset.table = Table( "library_dataset", metadata,
287    Column( "id", Integer, primary_key=True ),
288    Column( "library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id", use_alter=True, name="library_dataset_dataset_association_id_fk" ), nullable=True, index=True ),#current version of dataset, if null, there is not a current version selected
289    Column( "folder_id", Integer, ForeignKey( "library_folder.id" ), index=True ),
290    Column( "order_id", Integer ), #not currently being used, but for possible future use
291    Column( "create_time", DateTime, default=now ),
292    Column( "update_time", DateTime, default=now, onupdate=now ),
293    Column( "name", TrimmedString( 255 ), key="_name", index=True ), #when not None/null this will supercede display in library (but not when imported into user's history?)
294    Column( "info", TrimmedString( 255 ),  key="_info" ), #when not None/null this will supercede display in library (but not when imported into user's history?)
295    Column( "deleted", Boolean, index=True, default=False ),
296    Column( "purged", Boolean, index=True, default=False ) )
297
298model.LibraryDatasetDatasetAssociation.table = Table( "library_dataset_dataset_association", metadata,
299    Column( "id", Integer, primary_key=True ),
300    Column( "library_dataset_id", Integer, ForeignKey( "library_dataset.id" ), index=True ),
301    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
302    Column( "create_time", DateTime, default=now ),
303    Column( "update_time", DateTime, default=now, onupdate=now ),
304    Column( "state", TrimmedString( 64 ), index=True, key="_state" ),
305    Column( "copied_from_history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id", use_alter=True, name='history_dataset_association_dataset_id_fkey' ), nullable=True ),
306    Column( "copied_from_library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id", use_alter=True, name='library_dataset_dataset_association_id_fkey' ), nullable=True ),
307    Column( "name", TrimmedString( 255 ), index=True ),
308    Column( "info", TrimmedString( 255 ) ),
309    Column( "blurb", TrimmedString( 255 ) ),
310    Column( "peek" , TEXT ),
311    Column( "tool_version" , TEXT ),
312    Column( "extension", TrimmedString( 64 ) ),
313    Column( "metadata", MetadataType(), key="_metadata" ),
314    Column( "parent_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), nullable=True ),
315    Column( "designation", TrimmedString( 255 ) ),
316    Column( "deleted", Boolean, index=True, default=False ),
317    Column( "visible", Boolean ),
318    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
319    Column( "message", TrimmedString( 255 ) ),
320    Column( "extended_metadata_id", Integer,
321        ForeignKey( "extended_metadata.id" ), index=True )
322    )
323
324
325model.ExtendedMetadata.table = Table("extended_metadata", metadata,
326    Column( "id", Integer, primary_key=True ),
327    Column( "data", JSONType ) )
328
329model.ExtendedMetadataIndex.table = Table("extended_metadata_index", metadata,
330    Column( "id", Integer, primary_key=True ),
331    Column( "extended_metadata_id", Integer, ForeignKey("extended_metadata.id",
332                                                        onupdate="CASCADE",
333                                                        ondelete="CASCADE" ),
334                                             index=True ),
335    Column( "path", String( 255 )),
336    Column( "value", TEXT))
337
338model.Library.table = Table( "library", metadata,
339    Column( "id", Integer, primary_key=True ),
340    Column( "root_folder_id", Integer, ForeignKey( "library_folder.id" ), index=True ),
341    Column( "create_time", DateTime, default=now ),
342    Column( "update_time", DateTime, default=now, onupdate=now ),
343    Column( "name", String( 255 ), index=True ),
344    Column( "deleted", Boolean, index=True, default=False ),
345    Column( "purged", Boolean, index=True, default=False ),
346    Column( "description", TEXT ),
347    Column( "synopsis", TEXT ) )
348
349model.LibraryFolder.table = Table( "library_folder", metadata,
350    Column( "id", Integer, primary_key=True ),
351    Column( "parent_id", Integer, ForeignKey( "library_folder.id" ), nullable = True, index=True ),
352    Column( "create_time", DateTime, default=now ),
353    Column( "update_time", DateTime, default=now, onupdate=now ),
354    Column( "name", TEXT, index=True ),
355    Column( "description", TEXT ),
356    Column( "order_id", Integer ), #not currently being used, but for possible future use
357    Column( "item_count", Integer ),
358    Column( "deleted", Boolean, index=True, default=False ),
359    Column( "purged", Boolean, index=True, default=False ),
360    Column( "genome_build", TrimmedString( 40 ) ) )
361
362model.LibraryInfoAssociation.table = Table( 'library_info_association', metadata,
363    Column( "id", Integer, primary_key=True ),
364    Column( "library_id", Integer, ForeignKey( "library.id" ), index=True ),
365    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
366    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
367    Column( "inheritable", Boolean, index=True, default=False ),
368    Column( "deleted", Boolean, index=True, default=False ) )
369
370model.LibraryFolderInfoAssociation.table = Table( 'library_folder_info_association', metadata,
371    Column( "id", Integer, primary_key=True ),
372    Column( "library_folder_id", Integer, ForeignKey( "library_folder.id" ), nullable=True, index=True ),
373    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
374    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
375    Column( "inheritable", Boolean, index=True, default=False ),
376    Column( "deleted", Boolean, index=True, default=False ) )
377
378model.LibraryDatasetDatasetInfoAssociation.table = Table( 'library_dataset_dataset_info_association', metadata,
379    Column( "id", Integer, primary_key=True ),
380    Column( "library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), nullable=True, index=True ),
381    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
382    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
383    Column( "deleted", Boolean, index=True, default=False ) )
384
385model.Job.table = Table( "job", metadata,
386    Column( "id", Integer, primary_key=True ),
387    Column( "create_time", DateTime, default=now ),
388    Column( "update_time", DateTime, default=now, onupdate=now ),
389    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
390    Column( "library_folder_id", Integer, ForeignKey( "library_folder.id" ), index=True ),
391    Column( "tool_id", String( 255 ) ),
392    Column( "tool_version", TEXT, default="1.0.0" ),
393    Column( "state", String( 64 ), index=True ),
394    Column( "info", TrimmedString( 255 ) ),
395    Column( "command_line", TEXT ),
396    Column( "param_filename", String( 1024 ) ),
397    Column( "runner_name", String( 255 ) ),
398    Column( "stdout", TEXT ),
399    Column( "stderr", TEXT ),
400    Column( "exit_code", Integer, nullable=True ),
401    Column( "traceback", TEXT ),
402    Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True, nullable=True ),
403    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=True ),
404    Column( "job_runner_name", String( 255 ) ),
405    Column( "job_runner_external_id", String( 255 ) ),
406    Column( "destination_id", String( 255 ), nullable=True ),
407    Column( "destination_params", JSONType, nullable=True ),
408    Column( "object_store_id", TrimmedString( 255 ), index=True ),
409    Column( "imported", Boolean, default=False, index=True ),
410    Column( "params", TrimmedString(255), index=True ),
411    Column( "handler", TrimmedString( 255 ), index=True ) )
412
413model.JobParameter.table = Table( "job_parameter", metadata,
414    Column( "id", Integer, primary_key=True ),
415    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
416    Column( "name", String(255) ),
417    Column( "value", TEXT ) )
418
419model.JobToInputDatasetAssociation.table = Table( "job_to_input_dataset", metadata,
420    Column( "id", Integer, primary_key=True ),
421    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
422    Column( "dataset_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
423    Column( "name", String(255) ) )
424
425model.JobToOutputDatasetAssociation.table = Table( "job_to_output_dataset", metadata,
426    Column( "id", Integer, primary_key=True ),
427    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
428    Column( "dataset_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
429    Column( "name", String(255) ) )
430
431model.JobToInputLibraryDatasetAssociation.table = Table( "job_to_input_library_dataset", metadata,
432    Column( "id", Integer, primary_key=True ),
433    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
434    Column( "ldda_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True ),
435    Column( "name", String(255) ) )
436
437model.JobToOutputLibraryDatasetAssociation.table = Table( "job_to_output_library_dataset", metadata,
438    Column( "id", Integer, primary_key=True ),
439    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
440    Column( "ldda_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True ),
441    Column( "name", String(255) ) )
442
443model.JobExternalOutputMetadata.table = Table( "job_external_output_metadata", metadata,
444    Column( "id", Integer, primary_key=True ),
445    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
446    Column( "history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True, nullable=True ),
447    Column( "library_dataset_dataset_association_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True, nullable=True ),
448    Column( "filename_in", String( 255 ) ),
449    Column( "filename_out", String( 255 ) ),
450    Column( "filename_results_code", String( 255 ) ),
451    Column( "filename_kwds", String( 255 ) ),
452    Column( "filename_override_metadata", String( 255 ) ),
453    Column( "job_runner_external_pid", String( 255 ) ) )
454
455model.JobExportHistoryArchive.table = Table( "job_export_history_archive", metadata,
456    Column( "id", Integer, primary_key=True ),
457    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
458    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
459    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
460    Column( "compressed", Boolean, index=True, default=False ),
461    Column( "history_attrs_filename", TEXT ),
462    Column( "datasets_attrs_filename", TEXT ),
463    Column( "jobs_attrs_filename", TEXT )
464    )
465
466model.JobImportHistoryArchive.table = Table( "job_import_history_archive", metadata,
467    Column( "id", Integer, primary_key=True ),
468    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
469    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
470    Column( "archive_dir", TEXT )
471    )
472
473model.GenomeIndexToolData.table = Table( "genome_index_tool_data", metadata,
474    Column( "id", Integer, primary_key=True ),
475    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
476    Column( "deferred_job_id", Integer, ForeignKey( "deferred_job.id" ), index=True ),
477    Column( "transfer_job_id", Integer, ForeignKey( "transfer_job.id" ), index=True ),
478    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
479    Column( "fasta_path", String( 255 ) ),
480    Column( "created_time", DateTime, default=now ),
481    Column( "modified_time", DateTime, default=now, onupdate=now ),
482    Column( "indexer", String( 64 ) ),
483    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
484    )
485
486model.Task.table = Table( "task", metadata,
487    Column( "id", Integer, primary_key=True ),
488    Column( "create_time", DateTime, default=now ),
489    Column( "execution_time", DateTime ),
490    Column( "update_time", DateTime, default=now, onupdate=now ),
491    Column( "state", String( 64 ), index=True ),
492    Column( "command_line", TEXT ),
493    Column( "param_filename", String( 1024 ) ),
494    Column( "runner_name", String( 255 ) ),
495    Column( "stdout", TEXT ),
496    Column( "stderr", TEXT ),
497    Column( "exit_code", Integer, nullable=True ),
498    Column( "info", TrimmedString ( 255 ) ),
499    Column( "traceback", TEXT ),
500    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True, nullable=False ),
501    Column( "working_directory", String(1024)),
502    Column( "task_runner_name", String( 255 ) ),
503    Column( "task_runner_external_id", String( 255 ) ),
504    Column( "prepare_input_files_cmd", TEXT ) )
505
506model.PostJobAction.table = Table("post_job_action", metadata,
507    Column("id", Integer, primary_key=True),
508    Column("workflow_step_id", Integer, ForeignKey( "workflow_step.id" ), index=True, nullable=False),
509    Column("action_type", String(255), nullable=False),
510    Column("output_name", String(255), nullable=True),
511    Column("action_arguments", JSONType, nullable=True))
512
513model.PostJobActionAssociation.table = Table("post_job_action_association", metadata,
514    Column("id", Integer, primary_key=True),
515    Column("job_id", Integer, ForeignKey( "job.id" ), index=True, nullable=False),
516    Column("post_job_action_id", Integer, ForeignKey( "post_job_action.id" ), index=True, nullable=False))
517
518model.DeferredJob.table = Table( "deferred_job", metadata,
519    Column( "id", Integer, primary_key=True ),
520    Column( "create_time", DateTime, default=now ),
521    Column( "update_time", DateTime, default=now, onupdate=now ),
522    Column( "state", String( 64 ), index=True ),
523    Column( "plugin", String( 128 ), index=True ),
524    Column( "params", JSONType ) )
525
526model.TransferJob.table = Table( "transfer_job", metadata,
527    Column( "id", Integer, primary_key=True ),
528    Column( "create_time", DateTime, default=now ),
529    Column( "update_time", DateTime, default=now, onupdate=now ),
530    Column( "state", String( 64 ), index=True ),
531    Column( "path", String( 1024 ) ),
532    Column( "info", TEXT ),
533    Column( "pid", Integer ),
534    Column( "socket", Integer ),
535    Column( "params", JSONType ) )
536
537model.Event.table = Table( "event", metadata,
538    Column( "id", Integer, primary_key=True ),
539    Column( "create_time", DateTime, default=now ),
540    Column( "update_time", DateTime, default=now, onupdate=now ),
541    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True, nullable=True ),
542    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=True ),
543    Column( "message", TrimmedString( 1024 ) ),
544    Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True, nullable=True ),
545    Column( "tool_id", String( 255 ) ) )
546
547model.GalaxySession.table = Table( "galaxy_session", metadata,
548    Column( "id", Integer, primary_key=True ),
549    Column( "create_time", DateTime, default=now ),
550    Column( "update_time", DateTime, default=now, onupdate=now ),
551    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=True ),
552    Column( "remote_host", String( 255 ) ),
553    Column( "remote_addr", String( 255 ) ),
554    Column( "referer", TEXT ),
555    Column( "current_history_id", Integer, ForeignKey( "history.id" ), nullable=True ),
556    Column( "session_key", TrimmedString( 255 ), index=True, unique=True ), # unique 128 bit random number coerced to a string
557    Column( "is_valid", Boolean, default=False ),
558    Column( "prev_session_id", Integer ), # saves a reference to the previous session so we have a way to chain them together
559    Column( "disk_usage", Numeric( 15, 0 ), index=True ) )
560
561model.GalaxySessionToHistoryAssociation.table = Table( "galaxy_session_to_history", metadata,
562    Column( "id", Integer, primary_key=True ),
563    Column( "create_time", DateTime, default=now ),
564    Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True ),
565    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ) )
566
567model.StoredWorkflow.table = Table( "stored_workflow", metadata,
568    Column( "id", Integer, primary_key=True ),
569    Column( "create_time", DateTime, default=now ),
570    Column( "update_time", DateTime, default=now, onupdate=now ),
571    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=False ),
572    Column( "latest_workflow_id", Integer,
573            ForeignKey( "workflow.id", use_alter=True, name='stored_workflow_latest_workflow_id_fk' ), index=True ),
574    Column( "name", TEXT ),
575    Column( "deleted", Boolean, default=False ),
576    Column( "importable", Boolean, default=False ),
577    Column( "slug", TEXT, index=True ),
578    Column( "published", Boolean, index=True, default=False )
579    )
580
581model.Workflow.table = Table( "workflow", metadata,
582    Column( "id", Integer, primary_key=True ),
583    Column( "create_time", DateTime, default=now ),
584    Column( "update_time", DateTime, default=now, onupdate=now ),
585    Column( "stored_workflow_id", Integer, ForeignKey( "stored_workflow.id" ), index=True, nullable=False ),
586    Column( "name", TEXT ),
587    Column( "has_cycles", Boolean ),
588    Column( "has_errors", Boolean )
589    )
590
591model.WorkflowStep.table = Table( "workflow_step", metadata,
592    Column( "id", Integer, primary_key=True ),
593    Column( "create_time", DateTime, default=now ),
594    Column( "update_time", DateTime, default=now, onupdate=now ),
595    Column( "workflow_id", Integer, ForeignKey( "workflow.id" ), index=True, nullable=False ),
596    Column( "type", String(64) ),
597    Column( "tool_id", TEXT ),
598    Column( "tool_version", TEXT ), # Reserved for future
599    Column( "tool_inputs", JSONType ),
600    Column( "tool_errors", JSONType ),
601    Column( "position", JSONType ),
602    Column( "config", JSONType ),
603    Column( "order_index", Integer ),
604    ## Column( "input_connections", JSONType )
605    )
606
607model.WorkflowStepConnection.table = Table( "workflow_step_connection", metadata,
608    Column( "id", Integer, primary_key=True ),
609    Column( "output_step_id", Integer, ForeignKey( "workflow_step.id" ), index=True ),
610    Column( "input_step_id", Integer, ForeignKey( "workflow_step.id" ), index=True ),
611    Column( "output_name", TEXT ),
612    Column( "input_name", TEXT)
613    )
614
615model.WorkflowOutput.table = Table( "workflow_output", metadata,
616    Column( "id", Integer, primary_key=True ),
617    Column( "workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True, nullable=False),
618    Column( "output_name", String(255), nullable=True)
619    )
620
621model.WorkflowInvocation.table = Table( "workflow_invocation", metadata,
622    Column( "id", Integer, primary_key=True ),
623    Column( "create_time", DateTime, default=now ),
624    Column( "update_time", DateTime, default=now, onupdate=now ),
625    Column( "workflow_id", Integer, ForeignKey( "workflow.id" ), index=True, nullable=False )
626    )
627
628model.WorkflowInvocationStep.table = Table( "workflow_invocation_step", metadata,
629    Column( "id", Integer, primary_key=True ),
630    Column( "create_time", DateTime, default=now ),
631    Column( "update_time", DateTime, default=now, onupdate=now ),
632    Column( "workflow_invocation_id", Integer, ForeignKey( "workflow_invocation.id" ), index=True, nullable=False ),
633    Column( "workflow_step_id",  Integer, ForeignKey( "workflow_step.id" ), index=True, nullable=False ),
634    Column( "job_id",  Integer, ForeignKey( "job.id" ), index=True, nullable=True )
635    )
636
637model.StoredWorkflowUserShareAssociation.table = Table( "stored_workflow_user_share_connection", metadata,
638    Column( "id", Integer, primary_key=True ),
639    Column( "stored_workflow_id", Integer, ForeignKey( "stored_workflow.id" ), index=True ),
640    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
641    )
642
643model.StoredWorkflowMenuEntry.table = Table( "stored_workflow_menu_entry", metadata,
644    Column( "id", Integer, primary_key=True ),
645    Column( "stored_workflow_id", Integer, ForeignKey( "stored_workflow.id" ), index=True ),
646    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
647    Column( "order_index", Integer ) )
648
649model.MetadataFile.table = Table( "metadata_file", metadata,
650    Column( "id", Integer, primary_key=True ),
651    Column( "name", TEXT ),
652    Column( "hda_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True, nullable=True ),
653    Column( "lda_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True, nullable=True ),
654    Column( "create_time", DateTime, default=now ),
655    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
656    Column( "object_store_id", TrimmedString( 255 ), index=True ),
657    Column( "deleted", Boolean, index=True, default=False ),
658    Column( "purged", Boolean, index=True, default=False ) )
659
660model.FormDefinitionCurrent.table = Table('form_definition_current', metadata,
661    Column( "id", Integer, primary_key=True),
662    Column( "create_time", DateTime, default=now ),
663    Column( "update_time", DateTime, default=now, onupdate=now ),
664    Column( "latest_form_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
665    Column( "deleted", Boolean, index=True, default=False ))
666
667model.FormDefinition.table = Table('form_definition', metadata,
668    Column( "id", Integer, primary_key=True),
669    Column( "create_time", DateTime, default=now ),
670    Column( "update_time", DateTime, default=now, onupdate=now ),
671    Column( "name", TrimmedString( 255 ), nullable=False ),
672    Column( "desc", TEXT ),
673    Column( "form_definition_current_id",
674            Integer,
675            ForeignKey( "form_definition_current.id", name='for_def_form_def_current_id_fk', use_alter=True ),
676            index=True ),
677    Column( "fields", JSONType() ),
678    Column( "type", TrimmedString( 255 ), index=True ),
679    Column( "layout", JSONType() ), )
680
681model.ExternalService.table = Table( 'external_service', metadata,
682    Column( "id", Integer, primary_key=True ),
683    Column( "create_time", DateTime, default=now ),
684    Column( "update_time", DateTime, default=now, onupdate=now ),
685    Column( "name", TrimmedString( 255 ), nullable=False ),
686    Column( "description", TEXT ),
687    Column( "external_service_type_id", TrimmedString( 255 ), nullable=False ),
688    Column( "version", TrimmedString( 255 ) ),
689    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
690    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
691    Column( "deleted", Boolean, index=True, default=False ) )
692
693model.RequestType.table = Table('request_type', metadata,
694    Column( "id", Integer, primary_key=True),
695    Column( "create_time", DateTime, default=now ),
696    Column( "update_time", DateTime, default=now, onupdate=now ),
697    Column( "name", TrimmedString( 255 ), nullable=False ),
698    Column( "desc", TEXT ),
699    Column( "request_form_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
700    Column( "sample_form_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
701    Column( "deleted", Boolean, index=True, default=False ) )
702
703model.RequestTypeExternalServiceAssociation.table = Table( "request_type_external_service_association", metadata,
704    Column( "id", Integer, primary_key=True ),
705    Column( "request_type_id", Integer, ForeignKey( "request_type.id" ), index=True ),
706    Column( "external_service_id", Integer, ForeignKey( "external_service.id" ), index=True ) )
707
708model.RequestTypePermissions.table = Table( "request_type_permissions", metadata,
709    Column( "id", Integer, primary_key=True ),
710    Column( "create_time", DateTime, default=now ),
711    Column( "update_time", DateTime, default=now, onupdate=now ),
712    Column( "action", TEXT ),
713    Column( "request_type_id", Integer, ForeignKey( "request_type.id" ), nullable=True, index=True ),
714    Column( "role_id", Integer, ForeignKey( "role.id" ), index=True ) )
715
716model.FormValues.table = Table('form_values', metadata,
717    Column( "id", Integer, primary_key=True),
718    Column( "create_time", DateTime, default=now ),
719    Column( "update_time", DateTime, default=now, onupdate=now ),
720    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
721    Column( "content", JSONType()) )
722
723model.Request.table = Table('request', metadata,
724    Column( "id", Integer, primary_key=True),
725    Column( "create_time", DateTime, default=now ),
726    Column( "update_time", DateTime, default=now, onupdate=now ),
727    Column( "name", TrimmedString( 255 ), nullable=False ),
728    Column( "desc", TEXT ),
729    Column( "notification", JSONType() ),
730    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
731    Column( "request_type_id", Integer, ForeignKey( "request_type.id" ), index=True ),
732    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
733    Column( "deleted", Boolean, index=True, default=False ) )
734
735model.RequestEvent.table = Table('request_event', metadata,
736    Column( "id", Integer, primary_key=True),
737    Column( "create_time", DateTime, default=now ),
738    Column( "update_time", DateTime, default=now, onupdate=now ),
739    Column( "request_id", Integer, ForeignKey( "request.id" ), index=True ),
740    Column( "state", TrimmedString( 255 ),  index=True ),
741    Column( "comment", TEXT ) )
742
743model.Sample.table = Table('sample', metadata,
744    Column( "id", Integer, primary_key=True ),
745    Column( "create_time", DateTime, default=now ),
746    Column( "update_time", DateTime, default=now, onupdate=now ),
747    Column( "name", TrimmedString( 255 ), nullable=False ),
748    Column( "desc", TEXT ),
749    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
750    Column( "request_id", Integer, ForeignKey( "request.id" ), index=True ),
751    Column( "bar_code", TrimmedString( 255 ), index=True ),
752    Column( "library_id", Integer, ForeignKey( "library.id" ), index=True ),
753    Column( "folder_id", Integer, ForeignKey( "library_folder.id" ), index=True ),
754    Column( "deleted", Boolean, index=True, default=False ),
755    Column( "workflow", JSONType, nullable=True ),
756    Column( "history_id", Integer, ForeignKey( "history.id" ), nullable=True) )
757
758model.SampleState.table = Table('sample_state', metadata,
759    Column( "id", Integer, primary_key=True ),
760    Column( "create_time", DateTime, default=now ),
761    Column( "update_time", DateTime, default=now, onupdate=now ),
762    Column( "name", TrimmedString( 255 ), nullable=False ),
763    Column( "desc", TEXT ),
764    Column( "request_type_id", Integer, ForeignKey( "request_type.id" ), index=True ) )
765
766model.SampleEvent.table = Table('sample_event', metadata,
767    Column( "id", Integer, primary_key=True ),
768    Column( "create_time", DateTime, default=now ),
769    Column( "update_time", DateTime, default=now, onupdate=now ),
770    Column( "sample_id", Integer, ForeignKey( "sample.id" ), index=True ),
771    Column( "sample_state_id", Integer, ForeignKey( "sample_state.id" ), index=True ),
772    Column( "comment", TEXT ) )
773
774model.SampleDataset.table = Table('sample_dataset', metadata,
775    Column( "id", Integer, primary_key=True ),
776    Column( "create_time", DateTime, default=now ),
777    Column( "update_time", DateTime, default=now, onupdate=now ),
778    Column( "sample_id", Integer, ForeignKey( "sample.id" ), index=True ),
779    Column( "name", TrimmedString( 255 ), nullable=False ),
780    Column( "file_path", TEXT ),
781    Column( "status", TrimmedString( 255 ), nullable=False ),
782    Column( "error_msg", TEXT ),
783    Column( "size", TrimmedString( 255 ) ),
784    Column( "external_service_id", Integer, ForeignKey( "external_service.id" ), index=True ) )
785
786model.Run.table = Table( 'run', metadata,
787    Column( "id", Integer, primary_key=True ),
788    Column( "create_time", DateTime, default=now ),
789    Column( "update_time", DateTime, default=now, onupdate=now ),
790    Column( "form_definition_id", Integer, ForeignKey( "form_definition.id" ), index=True ),
791    Column( "form_values_id", Integer, ForeignKey( "form_values.id" ), index=True ),
792    Column( "deleted", Boolean, index=True, default=False ),
793    Column( "subindex", TrimmedString( 255 ), index=True ) )
794
795model.RequestTypeRunAssociation.table = Table( "request_type_run_association", metadata,
796    Column( "id", Integer, primary_key=True ),
797    Column( "request_type_id", Integer, ForeignKey( "request_type.id" ), index=True, nullable=False ),
798    Column( "run_id", Integer, ForeignKey( "run.id" ), index=True, nullable=False ) )
799
800model.SampleRunAssociation.table = Table( "sample_run_association", metadata,
801    Column( "id", Integer, primary_key=True ),
802    Column( "sample_id", Integer, ForeignKey( "sample.id" ), index=True, nullable=False ),
803    Column( "run_id", Integer, ForeignKey( "run.id" ), index=True, nullable=False ) )
804
805model.Page.table = Table( "page", metadata,
806    Column( "id", Integer, primary_key=True ),
807    Column( "create_time", DateTime, default=now ),
808    Column( "update_time", DateTime, default=now, onupdate=now ),
809    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=False ),
810    Column( "latest_revision_id", Integer,
811            ForeignKey( "page_revision.id", use_alter=True, name='page_latest_revision_id_fk' ), index=True ),
812    Column( "title", TEXT ),
813    Column( "slug", TEXT, unique=True, index=True ),
814    Column( "importable", Boolean, index=True, default=False ),
815    Column( "published", Boolean, index=True, default=False ),
816    Column( "deleted", Boolean, index=True, default=False ),
817    )
818
819model.PageRevision.table = Table( "page_revision", metadata,
820    Column( "id", Integer, primary_key=True ),
821    Column( "create_time", DateTime, default=now ),
822    Column( "update_time", DateTime, default=now, onupdate=now ),
823    Column( "page_id", Integer, ForeignKey( "page.id" ), index=True, nullable=False ),
824    Column( "title", TEXT ),
825    Column( "content", TEXT )
826    )
827
828model.PageUserShareAssociation.table = Table( "page_user_share_association", metadata,
829    Column( "id", Integer, primary_key=True ),
830    Column( "page_id", Integer, ForeignKey( "page.id" ), index=True ),
831    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
832    )
833
834model.Visualization.table = Table( "visualization", metadata,
835    Column( "id", Integer, primary_key=True ),
836    Column( "create_time", DateTime, default=now ),
837    Column( "update_time", DateTime, default=now, onupdate=now ),
838    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=False ),
839    Column( "latest_revision_id", Integer,
840            ForeignKey( "visualization_revision.id", use_alter=True, name='visualization_latest_revision_id_fk' ), index=True ),
841    Column( "title", TEXT ),
842    Column( "type", TEXT ),
843    Column( "dbkey", TEXT, index=True ),
844    Column( "deleted", Boolean, default=False, index=True ),
845    Column( "importable", Boolean, default=False, index=True ),
846    Column( "slug", TEXT, index=True ),
847    Column( "published", Boolean, default=False, index=True )
848    )
849
850model.VisualizationRevision.table = Table( "visualization_revision", metadata,
851    Column( "id", Integer, primary_key=True ),
852    Column( "create_time", DateTime, default=now ),
853    Column( "update_time", DateTime, default=now, onupdate=now ),
854    Column( "visualization_id", Integer, ForeignKey( "visualization.id" ), index=True, nullable=False ),
855    Column( "title", TEXT ),
856    Column( "dbkey", TEXT, index=True ),
857    Column( "config", JSONType )
858    )
859
860model.VisualizationUserShareAssociation.table = Table( "visualization_user_share_association", metadata,
861    Column( "id", Integer, primary_key=True ),
862    Column( "visualization_id", Integer, ForeignKey( "visualization.id" ), index=True ),
863    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
864    )
865
866#Data Manager tables
867model.DataManagerHistoryAssociation.table = Table( "data_manager_history_association", metadata,
868    Column( "id", Integer, primary_key=True),
869    Column( "create_time", DateTime, default=now ),
870    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
871    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
872    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
873    )
874
875model.DataManagerJobAssociation.table = Table( "data_manager_job_association", metadata,
876    Column( "id", Integer, primary_key=True),
877    Column( "create_time", DateTime, default=now ),
878    Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
879    Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
880    Column( "data_manager_id", TEXT, index=True )
881    )
882
883# Tagging tables.
884
885model.Tag.table = Table( "tag", metadata,
886    Column( "id", Integer, primary_key=True ),
887    Column( "type", Integer ),
888    Column( "parent_id", Integer, ForeignKey( "tag.id" ) ),
889    Column( "name", TrimmedString(255) ),
890    UniqueConstraint( "name" ) )
891
892model.HistoryTagAssociation.table = Table( "history_tag_association", metadata,
893    Column( "id", Integer, primary_key=True ),
894    Column( "history_id", Integer, ForeignKey( "history.id" ), index=True ),
895    Column( "tag_id", Integer, ForeignKey( "tag.id" ), index=True ),
896    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
897    Column( "user_tname", TrimmedString(255), index=True),
898    Column( "value", TrimmedString(255), index=True),
899    Column( "user_value", TrimmedString(255), index=True) )
900
901model.DatasetTagAssociation.table = Table( "dataset_tag_association", metadata,
902    Column( "id", Integer, primary_key=True ),
903    Column( "dataset_id", Integer, ForeignKey( "dataset.id" ), index=True ),
904    Column( "tag_id", Integer, ForeignKey( "tag.id" ), index=True ),
905    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
906    Column( "user_tname", TrimmedString(255), index=True),
907    Column( "value", TrimmedString(255), index=True),
908    Column( "user_value", TrimmedString(255), index=True) )
909
910model.HistoryDatasetAssociationTagAssociation.table = Table( "history_dataset_association_tag_association", metadata,
911    Column( "id", Integer, primary_key=True ),
912    Column( "history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
913    Column( "tag_id", Integer, ForeignKey( "tag.id" ), index=True ),
914    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
915    Column( "user_tname", TrimmedString(255), index=True),
916    Column( "value", TrimmedString(255), index=True),
917    Column( "user_value", TrimmedString(255), index=True) )
918
919

Large files files are truncated, but you can click here to view the full file