123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?php
- /**
- * Create the schema.
- *
- * @return array
- */
- function tripal_jbrowse_mgmt_schema() {
- $schema = [];
- $schema['tripal_jbrowse_mgmt_instances'] = [
- 'description' => 'JBrowse instances.',
- 'fields' => [
- 'id' => [
- 'type' => 'serial',
- 'description' => 'Primary key',
- 'not null' => TRUE,
- ],
- 'uid' => [
- 'type' => 'int',
- 'description' => 'Submitter\'s User id',
- 'not null' => TRUE,
- ],
- 'organism_id' => [
- 'type' => 'int',
- 'not null' => TRUE,
- ],
- 'analysis_id' => [
- 'type' => 'int',
- 'not null' => FALSE,
- ],
- 'title' => [
- 'type' => 'varchar',
- 'length' => 255,
- ],
- 'description' => [
- 'type' => 'text',
- 'not null' => FALSE,
- ],
- 'file' => [
- 'type' => 'text',
- 'not null' => FALSE,
- ],
- 'created_at' => [
- 'type' => 'int',
- 'not null' => 'true',
- ],
- ],
- 'primary key' => [
- 'id',
- ],
- ];
- $schema['tripal_jbrowse_mgmt_tracks'] = [
- 'description' => 'JBrowse tracks.',
- 'fields' => [
- 'id' => [
- 'type' => 'serial',
- 'description' => 'Primary key',
- 'not null' => TRUE,
- ],
- 'uid' => [
- 'type' => 'int',
- 'description' => 'Submitter\'s User id',
- 'not null' => TRUE,
- ],
- 'instance_id' => [
- 'type' => 'int',
- 'not null' => TRUE,
- ],
- 'organism_id' => [
- 'type' => 'int',
- 'not null' => FALSE,
- ],
- 'label' => [
- 'type' => 'varchar',
- 'length' => 255,
- ],
- 'track_type' => [
- 'type' => 'varchar',
- 'length' => 255,
- ],
- 'file_type' => [
- 'type' => 'varchar',
- 'length' => 255,
- ],
- 'file' => [
- 'type' => 'text',
- ],
- 'created_at' => [
- 'type' => 'int',
- 'not null' => TRUE,
- ],
- 'is_deleted' => [
- 'type' => 'int',
- 'not null' => FALSE,
- 'default' => 0,
- ],
- ],
- 'primary key' => [
- 'id',
- ],
- ];
- $schema['tripal_jbrowse_mgmt_instanceprop'] = [
- 'description' => 'JBrowse Instance Metadata.',
- 'fields' => [
- 'instance_id' => [
- 'type' => 'int',
- 'not null' => TRUE,
- ],
- 'property_type' => [
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ],
- 'value' => [
- 'type' => 'text',
- ],
- ]
- ];
- return $schema;
- }
- /**
- * Create instance metadata table.
- */
- function tripal_jbrowse_mgmt_update_7001(&$sandbox) {
- $schema = tripal_jbrowse_mgmt_schema();
- $name = "tripal_jbrowse_mgmt_instanceprop";
- $table = $schema[$name];
- db_create_table($name, $table);
- }
- /**
- * adding a new column analysis_id to table tripal_jbrowse_mgmt_instances
- */
- function tripal_jbrowse_mgmt_update_7002(&$sandbox){
- $new_col_spec = [
- 'type' => 'int',
- 'not null' => FALSE,
- ];
- $schema = Database::getConnection()->schema();
- $schema->addField('tripal_jbrowse_mgmt_instances', 'analysis_id', $new_col_spec);
- }
|