Skip to content

Commit 0a7dae0

Browse files
committed
Add missing tables
1 parent b2109da commit 0a7dae0

File tree

9 files changed

+54
-7
lines changed

9 files changed

+54
-7
lines changed

api/app/models/drmdb/batch.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class DRMDB::Batch < DRMDB::Record
2+
self.table_name = 'batch'
3+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class DRMDB::SubmissionComponent < DRMDB::Record
2+
self.table_name = 'submission_component'
3+
4+
belongs_to :submission_group, class_name: 'DRMDB::SubmissionGroup', foreign_key: 'grp_id', primary_key: 'grp_id'
5+
end

api/app/models/drmdb/submission_group.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ class DRMDB::SubmissionGroup < DRMDB::Record
33

44
belongs_to :submission, class_name: "DRMDB::Submission", foreign_key: "sub_id"
55

6-
has_many :accession_relations, class_name: "DRMDB::AccessionRelation", foreign_key: "grp_id", primary_key: "grp_id"
7-
has_many :ext_relations, class_name: "DRMDB::ExtRelation", foreign_key: "grp_id", primary_key: "grp_id"
6+
has_many :submission_components, class_name: "DRMDB::SubmissionComponent", foreign_key: "grp_id", primary_key: "grp_id"
7+
has_many :accession_relations, class_name: "DRMDB::AccessionRelation", foreign_key: "grp_id", primary_key: "grp_id"
8+
has_many :ext_relations, class_name: "DRMDB::ExtRelation", foreign_key: "grp_id", primary_key: "grp_id"
89

910
has_many :accession_entities, through: :accession_relations
1011
has_many :meta_entities, through: :accession_relations

api/db/bioproject_migrate/20240827022556_bioproject_init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class BioProjectInit < ActiveRecord::Migration[7.2]
1+
class BioProjectInit < ActiveRecord::Migration[8.0]
22
def change
33
execute 'CREATE SCHEMA mass'
44

api/db/biosample_migrate/20240829001416_biosample_init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class BioSampleInit < ActiveRecord::Migration[7.2]
1+
class BioSampleInit < ActiveRecord::Migration[8.0]
22
def change
33
execute 'CREATE SCHEMA mass'
44

api/db/drasearch_migrate/20241023004659_dra_search_init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class DRASearchInit < ActiveRecord::Migration[7.2]
1+
class DRASearchInit < ActiveRecord::Migration[8.0]
22
def change
33
execute 'CREATE SCHEMA sra'
44

api/db/drmdb_migrate/20240827024216_drmdb_init.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class DRMDBInit < ActiveRecord::Migration[7.2]
1+
class DRMDBInit < ActiveRecord::Migration[8.0]
22
def change
33
execute 'CREATE SCHEMA mass'
44

@@ -20,6 +20,19 @@ def change
2020
t.bigint :p_acc_id
2121
end
2222

23+
create_table 'mass.batch', id: false do |t|
24+
t.bigint :bat_id, primary_key: true
25+
26+
t.integer :status, null: false
27+
t.timestamp :updated, null: false, default: -> { "DATE_TRUNC('second', NOW())" }
28+
t.bigint :main_meta_id, null: false
29+
t.bigint :sub_meta_id, null: false
30+
t.bigint :usr_id, null: false
31+
t.integer :serial, null: false
32+
t.text :machine
33+
t.integer :priority, null: false, default: 50
34+
end
35+
2336
create_table 'mass.ext_entity', id: false do |t|
2437
t.bigint :ext_id, primary_key: true
2538

@@ -87,6 +100,14 @@ def change
87100
t.text :note
88101
end
89102

103+
create_table 'mass.submission_component', id: false do |t|
104+
t.bigint :det_id, primary_key: true
105+
106+
t.bigint :grp_id, null: false
107+
t.text :field_key, null: false
108+
t.text :field_value, null: false
109+
end
110+
90111
create_table 'mass.submission_group', id: false do |t|
91112
t.bigint :grp_id, primary_key: true
92113

api/db/drmdb_schema.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
t.bigint "p_acc_id"
3131
end
3232

33+
create_table "batch", primary_key: "bat_id", force: :cascade do |t|
34+
t.integer "status", null: false
35+
t.datetime "updated", precision: nil, default: -> { "date_trunc('second'::text, now())" }, null: false
36+
t.bigint "main_meta_id", null: false
37+
t.bigint "sub_meta_id", null: false
38+
t.bigint "usr_id", null: false
39+
t.integer "serial", null: false
40+
t.text "machine"
41+
t.integer "priority", default: 50, null: false
42+
end
43+
3344
create_table "ext_entity", primary_key: "ext_id", force: :cascade do |t|
3445
t.text "acc_type", null: false
3546
t.text "ref_name", null: false
@@ -85,6 +96,12 @@
8596
t.text "note"
8697
end
8798

99+
create_table "submission_component", primary_key: "det_id", force: :cascade do |t|
100+
t.bigint "grp_id", null: false
101+
t.text "field_key", null: false
102+
t.text "field_value", null: false
103+
end
104+
88105
create_table "submission_group", primary_key: "grp_id", force: :cascade do |t|
89106
t.bigint "sub_id", null: false
90107
t.integer "submit_version", null: false

api/db/submitterdb_migrate/20240827023903_submitterdb_init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class SubmitterDBInit < ActiveRecord::Migration[7.2]
1+
class SubmitterDBInit < ActiveRecord::Migration[8.0]
22
def change
33
execute 'CREATE SCHEMA mass'
44

0 commit comments

Comments
 (0)