inferno_core 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno.rb +4 -0
  3. data/lib/inferno/apps/web/controllers/test_runs/create.rb +17 -10
  4. data/lib/inferno/apps/web/controllers/test_runs/show.rb +10 -0
  5. data/lib/inferno/apps/web/controllers/test_sessions/create.rb +1 -0
  6. data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +22 -0
  7. data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -1
  8. data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +21 -0
  9. data/lib/inferno/apps/web/router.rb +15 -0
  10. data/lib/inferno/apps/web/serializers/request.rb +1 -0
  11. data/lib/inferno/apps/web/serializers/result.rb +8 -0
  12. data/lib/inferno/apps/web/serializers/session_data.rb +10 -0
  13. data/lib/inferno/apps/web/serializers/test.rb +1 -3
  14. data/lib/inferno/apps/web/serializers/test_group.rb +2 -3
  15. data/lib/inferno/apps/web/serializers/test_run.rb +1 -0
  16. data/lib/inferno/apps/web/serializers/test_session.rb +1 -1
  17. data/lib/inferno/apps/web/serializers/test_suite.rb +1 -0
  18. data/lib/inferno/config/application.rb +4 -2
  19. data/lib/inferno/config/boot.rb +2 -0
  20. data/lib/inferno/config/boot/db.rb +10 -1
  21. data/lib/inferno/config/boot/sidekiq.rb +11 -0
  22. data/lib/inferno/db/migrations/001_create_initial_structure.rb +0 -21
  23. data/lib/inferno/db/migrations/002_add_wait_support.rb +7 -0
  24. data/lib/inferno/db/migrations/003_update_session_data.rb +18 -0
  25. data/lib/inferno/db/migrations/004_add_request_results_table.rb +9 -0
  26. data/lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb +5 -0
  27. data/lib/inferno/db/schema.rb +154 -0
  28. data/lib/inferno/dsl.rb +1 -3
  29. data/lib/inferno/dsl/fhir_client_builder.rb +16 -0
  30. data/lib/inferno/dsl/request_storage.rb +12 -0
  31. data/lib/inferno/dsl/results.rb +49 -0
  32. data/lib/inferno/dsl/resume_test_route.rb +89 -0
  33. data/lib/inferno/dsl/runnable.rb +96 -7
  34. data/lib/inferno/entities.rb +1 -1
  35. data/lib/inferno/entities/header.rb +7 -7
  36. data/lib/inferno/entities/message.rb +8 -6
  37. data/lib/inferno/entities/request.rb +40 -14
  38. data/lib/inferno/entities/result.rb +34 -18
  39. data/lib/inferno/entities/session_data.rb +33 -0
  40. data/lib/inferno/entities/test.rb +20 -7
  41. data/lib/inferno/entities/test_run.rb +13 -6
  42. data/lib/inferno/entities/test_session.rb +8 -8
  43. data/lib/inferno/exceptions.rb +12 -0
  44. data/lib/inferno/jobs.rb +16 -0
  45. data/lib/inferno/jobs/execute_test_run.rb +14 -0
  46. data/lib/inferno/jobs/resume_test_run.rb +14 -0
  47. data/lib/inferno/public/bundle.js +1 -1
  48. data/lib/inferno/repositories/repository.rb +13 -0
  49. data/lib/inferno/repositories/requests.rb +5 -4
  50. data/lib/inferno/repositories/results.rb +151 -3
  51. data/lib/inferno/repositories/session_data.rb +47 -0
  52. data/lib/inferno/repositories/test_runs.rb +66 -0
  53. data/lib/inferno/test_runner.rb +121 -29
  54. data/lib/inferno/utils/middleware/request_logger.rb +16 -3
  55. data/lib/inferno/version.rb +1 -1
  56. data/spec/factories/result.rb +8 -0
  57. data/spec/factories/test_run.rb +2 -0
  58. metadata +32 -5
  59. data/lib/inferno/dsl/fhir_manipulation.rb +0 -25
  60. data/lib/inferno/entities/test_input.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8655cec1d50119f35eb0072e3d65375a78d9233d60ea8ffe3f745c400b941d5
4
- data.tar.gz: c7f163bd24c8a5272c803587d9c87680b5b108a9b7f5cd777344ff15d762d4fb
3
+ metadata.gz: 9cb5242ae380d8cbec854482b0c91497f22180b770729bd0c7a12e135669b03a
4
+ data.tar.gz: b56d498246e148d5f850c8bc411f90b270dcfb3ab12c59002bcf60c8d56ba526
5
5
  SHA512:
6
- metadata.gz: 12573879f154dfd74c005aeb334c2dec65539345411bb3acfd959d0403fab4481cc5379c1ed28e9639bb09825ce8f2793883d6398da09a98fb8d00f145e11489
7
- data.tar.gz: cbf9464a7e571dcef1d6f8c304c3ceadd545eeb7a54be18ded1f58280b77e34a449242f21672bdd8fa400347f425821dfb6fb096be82147537c480dd9e15a7fe
6
+ metadata.gz: 51284afddfe06b44c144ec9ab20f0aacff605c8bc66f13dc89d02a58c941716cac28896903a82cb7ad3784b1e4287900da98421fea7d9df7af7e2d04ead7e97a
7
+ data.tar.gz: f8b3e900410909fdbb5bb8cc2513a152580a84b1a5dbafa571838d24d051d167698be30cce1fb5b41bb8b66c09f3b1b6c405dff1a81e31466e490983265b12f3
data/lib/inferno.rb CHANGED
@@ -6,10 +6,14 @@ require_relative 'inferno/config/application'
6
6
  require_relative 'inferno/dsl'
7
7
  require_relative 'inferno/entities'
8
8
  require_relative 'inferno/exceptions'
9
+ require_relative 'inferno/jobs'
9
10
  require_relative 'inferno/repositories'
10
11
  require_relative 'inferno/spec_support'
11
12
  require_relative 'inferno/test_runner'
12
13
  require_relative 'inferno/version'
13
14
 
14
15
  module Inferno
16
+ def self.routes
17
+ @routes ||= []
18
+ end
15
19
  end
@@ -3,28 +3,35 @@ module Inferno
3
3
  module Controllers
4
4
  module TestRuns
5
5
  class Create < Controller
6
- include Import[test_sessions_repo: 'repositories.test_sessions']
6
+ include Import[
7
+ test_sessions_repo: 'repositories.test_sessions',
8
+ session_data_repo: 'repositories.session_data'
9
+ ]
7
10
 
8
11
  PARAMS = [:test_session_id, :test_suite_id, :test_group_id, :test_id].freeze
9
12
 
10
13
  def call(params)
11
- test_run = repo.create(create_params(params))
12
- inputs = (params[:inputs] || {}).each_with_object({}) do |input, new_inputs|
13
- new_inputs[input[:name].to_sym] = input[:value]
14
- end
14
+ test_session = test_sessions_repo.find(params[:test_session_id])
15
15
 
16
- test_session = test_sessions_repo.find(test_run.test_session_id)
17
16
  # if testsession.nil?
18
17
 
19
- TestRunner
20
- .new(test_session: test_session, test_run: test_run)
21
- .run(test_run.runnable, inputs)
22
-
18
+ test_run = repo.create(create_params(params).merge(status: 'queued'))
23
19
  self.body = serialize(test_run)
20
+
21
+ params[:inputs]&.each do |input|
22
+ session_data_repo.save(
23
+ test_session_id: test_session.id,
24
+ name: input[:name],
25
+ value: input[:value]
26
+ )
27
+ end
28
+
29
+ Jobs.perform(Jobs::ExecuteTestRun, test_run.id)
24
30
  rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation => e
25
31
  self.body = { errors: e.message }.to_json
26
32
  self.status = 422
27
33
  rescue StandardError => e
34
+ Application['logger'].error(e.full_message)
28
35
  self.body = { errors: e.message }.to_json
29
36
  self.status = 500
30
37
  end
@@ -7,6 +7,16 @@ module Inferno
7
7
  test_run = repo.find(params[:id])
8
8
  halt 404 if test_run.nil?
9
9
 
10
+ if params[:include_results] == 'true'
11
+ results_repo = Inferno::Repositories::Results.new
12
+ test_run.results =
13
+ if params[:after].present?
14
+ results_repo.test_run_results_after(test_run_id: test_run.id, after: Time.parse(params[:after]))
15
+ else
16
+ repo.results_for_test_run(test_run.id)
17
+ end
18
+ end
19
+
10
20
  self.body = serialize(test_run)
11
21
  end
12
22
  end
@@ -12,6 +12,7 @@ module Inferno
12
12
  self.body = { errors: e.message }.to_json
13
13
  self.status = 422
14
14
  rescue StandardError => e
15
+ Application['logger'].error(e.full_message)
15
16
  self.body = { errors: e.message }.to_json
16
17
  self.status = 500
17
18
  end
@@ -0,0 +1,22 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ module TestSessions
5
+ class LastTestRun < Controller
6
+ include Import[test_runs_repo: 'repositories.test_runs']
7
+
8
+ def call(params)
9
+ test_run = test_runs_repo.last_test_run(params[:test_session_id])
10
+
11
+ self.body =
12
+ if test_run.nil?
13
+ nil
14
+ else
15
+ Inferno::Web::Serializers::TestRun.render(test_run)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -7,7 +7,12 @@ module Inferno
7
7
  include Import[test_sessions_repo: 'repositories.test_sessions']
8
8
 
9
9
  def call(params)
10
- self.body = serialize(test_sessions_repo.results_for_test_session(params[:test_session_id]))
10
+ self.body =
11
+ if params[:all] == 'true'
12
+ serialize(test_sessions_repo.results_for_test_session(params[:test_session_id]))
13
+ else
14
+ serialize(repo.current_results_for_test_session(params[:test_session_id]))
15
+ end
11
16
  end
12
17
  end
13
18
  end
@@ -0,0 +1,21 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ module TestSessions
5
+ module SessionData
6
+ class Index < Controller
7
+ include Import[session_data_repo: 'repositories.session_data']
8
+
9
+ def self.resource_class
10
+ 'SessionData'
11
+ end
12
+
13
+ def call(params)
14
+ self.body = serialize(session_data_repo.get_all_from_session(params[:test_session_id]))
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -13,7 +13,11 @@ module Inferno
13
13
 
14
14
  resources 'test_sessions', only: [:create, :show] do
15
15
  resources 'results', only: [:index]
16
+ resources 'session_data', only: [:index]
16
17
  end
18
+ get 'test_sessions/:test_session_id/last_test_run',
19
+ to: Inferno::Web::Controllers::TestSessions::LastTestRun,
20
+ as: :last_test_run
17
21
 
18
22
  resources 'test_suites', only: [:index, :show]
19
23
 
@@ -22,6 +26,17 @@ module Inferno
22
26
 
23
27
  get '/', to: ->(_env) { [200, {}, [client_page]] }
24
28
  get '/test_sessions/:id', to: ->(_env) { [200, {}, [client_page]] }
29
+
30
+ Inferno.routes.each do |route|
31
+ cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
32
+ path = "/custom/#{cleaned_id}#{route[:path]}"
33
+ Application['logger'].info("Registering custom route: #{path}")
34
+ if route[:method] == :all
35
+ mount route[:handler], at: path
36
+ else
37
+ send(route[:method], path, to: route[:handler])
38
+ end
39
+ end
25
40
  end
26
41
  end
27
42
  end
@@ -9,6 +9,7 @@ module Inferno
9
9
  field :url
10
10
  field :direction
11
11
  field :status
12
+ field :result_id
12
13
  end
13
14
 
14
15
  view :full do
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  module Inferno
2
4
  module Web
3
5
  module Serializers
@@ -12,6 +14,12 @@ module Inferno
12
14
  field :test_session_id
13
15
  field :result
14
16
  field :result_message, if: :field_present?
17
+ field :created_at
18
+ field :updated_at
19
+
20
+ field :outputs do |result, _options|
21
+ result.output_json.present? ? JSON.parse(result.output_json) : []
22
+ end
15
23
 
16
24
  association :messages, blueprint: Message, if: :field_present?
17
25
  association :requests, blueprint: Request, view: :summary, if: :field_present?
@@ -0,0 +1,10 @@
1
+ module Inferno
2
+ module Web
3
+ module Serializers
4
+ class SessionData < Serializer
5
+ field :name
6
+ field :value
7
+ end
8
+ end
9
+ end
10
+ end
@@ -4,9 +4,7 @@ module Inferno
4
4
  class Test < Serializer
5
5
  identifier :id
6
6
  field :title
7
- field :inputs do |test, _options|
8
- test.inputs.map { |input| { name: input } }
9
- end
7
+ field :inputs
10
8
  field :outputs do |test, _options|
11
9
  test.outputs.map { |output| { name: output } }
12
10
  end
@@ -7,13 +7,12 @@ module Inferno
7
7
  # TODO: fill out test group
8
8
  field :title
9
9
  field :description
10
+ field :test_count
10
11
  # field :run_as_group
11
12
 
12
13
  association :groups, name: :test_groups, blueprint: TestGroup
13
14
  association :tests, blueprint: Test
14
- field :inputs do |group, _options|
15
- group.inputs.map { |input| { name: input } }
16
- end
15
+ field :inputs
17
16
  field :outputs do |group, _options|
18
17
  group.outputs.map { |input| { name: input } }
19
18
  end
@@ -6,6 +6,7 @@ module Inferno
6
6
  field :test_session_id
7
7
 
8
8
  field :status
9
+ field :test_count
9
10
 
10
11
  field :test_group_id, if: :field_present?
11
12
  field :test_suite_id, if: :field_present?
@@ -9,7 +9,7 @@ module Inferno
9
9
  field :test_suite_id
10
10
 
11
11
  association :test_suite, blueprint: TestSuite, view: :full
12
- # association :test_run, blueprint: TestRun
12
+ # association :test_runs, blueprint: TestRun
13
13
  # association :results, blueprint: Result
14
14
  end
15
15
  end
@@ -6,6 +6,7 @@ module Inferno
6
6
  identifier :id
7
7
  field :title
8
8
  field :description
9
+ field :test_count
9
10
  end
10
11
 
11
12
  view :full do
@@ -1,3 +1,4 @@
1
+ require 'dry/system/container'
1
2
  require_relative 'boot'
2
3
 
3
4
  module Inferno
@@ -6,6 +7,9 @@ module Inferno
6
7
 
7
8
  use :env, inferrer: -> { ENV.fetch('APP_ENV', :development).to_sym }
8
9
 
10
+ Application.register('js_host', ENV.fetch('JS_HOST', ''))
11
+ Application.register('async_jobs', ENV['ASYNC_JOBS'] != 'false')
12
+
9
13
  configure do |config|
10
14
  config.root = File.expand_path('../../..', __dir__)
11
15
  config.default_namespace = 'inferno'
@@ -15,8 +19,6 @@ module Inferno
15
19
  config.auto_register = 'lib'
16
20
  end
17
21
 
18
- Application.register('js_host', ENV.fetch('JS_HOST', ''))
19
-
20
22
  load_paths!('lib')
21
23
  end
22
24
  end
@@ -1,3 +1,5 @@
1
+ require 'dotenv'
2
+
1
3
  ENV['APP_ENV'] ||= 'development'
2
4
 
3
5
  root_path = Dir.pwd
@@ -1,3 +1,5 @@
1
+ require 'sequel'
2
+
1
3
  Inferno::Application.boot(:db) do
2
4
  init do
3
5
  use :logging
@@ -17,7 +19,14 @@ Inferno::Application.boot(:db) do
17
19
 
18
20
  start do
19
21
  Sequel.extension :migration
22
+ db = Inferno::Application['db.connection']
20
23
  migration_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'migrations')
21
- Sequel::Migrator.run(Inferno::Application['db.connection'], migration_path)
24
+ Sequel::Migrator.run(db, migration_path)
25
+
26
+ if ENV['APP_ENV'] == 'development'
27
+ schema_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'schema.rb')
28
+ db.extension :schema_dumper
29
+ File.open(schema_path, 'w') { |f| f.print(db.dump_schema_migration) }
30
+ end
22
31
  end
23
32
  end
@@ -0,0 +1,11 @@
1
+ require 'sidekiq'
2
+
3
+ Inferno::Application.boot(:sidekiq) do
4
+ init do
5
+ if Inferno::Application['async_jobs']
6
+ Sidekiq.configure_server do |config|
7
+ config.redis = { url: ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379/0') }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,26 +1,5 @@
1
1
  Sequel.migration do
2
2
  change do
3
- #
4
- # NOT NEEDED BECUASE THEY ARE DEFINED WITHIN TEST SUITE.
5
- # MUST BE REFERENCED USING SOME KIND OF GLOBALLY UNIQUE KEY
6
- # THAT IS REPRESENTED AS A STRING
7
- #
8
-
9
- # create_table :test_suites do
10
- # end
11
-
12
- # create_table :test_groups do
13
- # end
14
-
15
- # create_table :tests do
16
- # end
17
-
18
- # create_table :test_inputs do
19
- # end
20
-
21
- # create_table :test_outputs do
22
- # end
23
-
24
3
  # A way for the test to signal that it requires some kind of action by the
25
4
  # app that is invoking the test (e.g. SMART Launch, perhaps mid-test manual verification)
26
5
  # create_table :test_prompts do
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_column :test_runs, :identifier, String, text: true
4
+ add_column :test_runs, :wait_timeout, DateTime
5
+ add_index :test_runs, [:status, :identifier, :wait_timeout, :updated_at], concurrently: true
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ Sequel.migration do
2
+ change do
3
+ drop_table :test_run_inputs
4
+ drop_table :result_inputs
5
+
6
+ set_column_type :session_data, :value, String, text: true
7
+ drop_index :session_data, [:test_session_id, :name], concurrently: true
8
+ add_index :session_data, [:test_session_id, :name], unique: true, concurrently: true
9
+ drop_index :session_data, :id, concurrently: true
10
+ add_index :session_data, :id, unique: true, concurrently: true
11
+
12
+ add_column :results, :input_json, String, text: true
13
+ add_column :results, :output_json, String, text: true
14
+ add_index :results, [:test_session_id, :test_id], concurrently: true
15
+ add_index :results, [:test_session_id, :test_group_id], concurrently: true
16
+ add_index :results, [:test_session_id, :test_suite_id], concurrently: true
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ Sequel.migration do
2
+ change do
3
+ create_table :requests_results do
4
+ # using results_id instead of result_id to avoid ambiguous column error
5
+ foreign_key :results_id, :results, index: true, type: String, null: false
6
+ foreign_key :requests_id, :requests, index: true, type: String, null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_index :results, [:test_run_id, :updated_at], concurrently: true
4
+ end
5
+ end
@@ -0,0 +1,154 @@
1
+ Sequel.migration do
2
+ change do
3
+ create_table(:schema_info) do
4
+ Integer :version, :default=>0, :null=>false
5
+ end
6
+
7
+ create_table(:test_sessions) do
8
+ String :id, :size=>255, :null=>false
9
+ String :test_suite_id, :size=>255
10
+ DateTime :created_at, :null=>false
11
+ DateTime :updated_at, :null=>false
12
+
13
+ primary_key [:id]
14
+ end
15
+
16
+ create_table(:session_data, :ignore_index_errors=>true) do
17
+ String :id, :size=>255, :null=>false
18
+ foreign_key :test_session_id, :test_sessions, :type=>String, :size=>255
19
+ String :name, :size=>255
20
+ String :value, :text=>true
21
+
22
+ index [:id], :unique=>true
23
+ index [:test_session_id]
24
+ index [:test_session_id, :name], :unique=>true
25
+ end
26
+
27
+ create_table(:test_runs, :ignore_index_errors=>true) do
28
+ String :id, :size=>255, :null=>false
29
+ String :status, :size=>255
30
+ foreign_key :test_session_id, :test_sessions, :type=>String, :size=>255
31
+ String :test_suite_id, :size=>255
32
+ String :test_group_id, :size=>255
33
+ String :test_id, :size=>255
34
+ DateTime :created_at, :null=>false
35
+ DateTime :updated_at, :null=>false
36
+ String :identifier, :text=>true
37
+ DateTime :wait_timeout
38
+
39
+ primary_key [:id]
40
+
41
+ index [:status, :identifier, :wait_timeout, :updated_at]
42
+ index [:test_group_id]
43
+ index [:test_id]
44
+ index [:test_session_id]
45
+ index [:test_session_id, :status]
46
+ index [:test_suite_id]
47
+ end
48
+
49
+ create_table(:results, :ignore_index_errors=>true) do
50
+ String :id, :size=>255, :null=>false
51
+ foreign_key :test_run_id, :test_runs, :type=>String, :size=>255
52
+ foreign_key :test_session_id, :test_sessions, :type=>String, :size=>255
53
+ String :result, :size=>255
54
+ String :result_message, :size=>255
55
+ String :test_suite_id, :size=>255
56
+ String :test_group_id, :size=>255
57
+ String :test_id, :size=>255
58
+ DateTime :created_at, :null=>false
59
+ DateTime :updated_at, :null=>false
60
+ String :input_json, :text=>true
61
+ String :output_json, :text=>true
62
+
63
+ primary_key [:id]
64
+
65
+ index [:test_run_id]
66
+ index [:test_run_id, :updated_at]
67
+ index [:test_session_id]
68
+ index [:test_session_id, :test_group_id]
69
+ index [:test_session_id, :test_id]
70
+ index [:test_session_id, :test_suite_id]
71
+ end
72
+
73
+ create_table(:messages, :ignore_index_errors=>true) do
74
+ primary_key :index
75
+ String :id, :size=>255, :null=>false
76
+ foreign_key :result_id, :results, :type=>String, :size=>255
77
+ String :type, :size=>255
78
+ String :message, :size=>255
79
+ DateTime :created_at, :null=>false
80
+ DateTime :updated_at, :null=>false
81
+
82
+ index [:id]
83
+ index [:result_id]
84
+ end
85
+
86
+ create_table(:requests, :ignore_index_errors=>true) do
87
+ primary_key :index
88
+ String :id, :size=>255, :null=>false
89
+ String :verb, :size=>255
90
+ String :url, :size=>255
91
+ String :direction, :size=>255
92
+ Integer :status
93
+ String :name, :size=>255
94
+ String :request_body, :text=>true
95
+ String :response_body, :text=>true
96
+ foreign_key :result_id, :results, :type=>String, :size=>255
97
+ foreign_key :test_session_id, :test_sessions, :type=>String, :size=>255
98
+ String :"[:test_session_id, :name]"
99
+ DateTime :created_at, :null=>false
100
+ DateTime :updated_at, :null=>false
101
+
102
+ index [:id]
103
+ index [:result_id]
104
+ index [:test_session_id]
105
+ end
106
+
107
+ create_table(:result_outputs, :ignore_index_errors=>true) do
108
+ String :id, :size=>255, :null=>false
109
+ foreign_key :result_id, :results, :type=>String, :size=>255
110
+ String :test_output_id, :size=>255
111
+ String :value, :size=>255
112
+ DateTime :created_at, :null=>false
113
+ DateTime :updated_at, :null=>false
114
+
115
+ primary_key [:id]
116
+
117
+ index [:result_id]
118
+ end
119
+
120
+ create_table(:result_prompt_values, :ignore_index_errors=>true) do
121
+ String :id, :size=>255, :null=>false
122
+ foreign_key :result_id, :results, :type=>String, :size=>255
123
+ String :test_prompt_id, :size=>255, :null=>false
124
+ String :value, :size=>255, :null=>false
125
+ DateTime :created_at, :null=>false
126
+ DateTime :updated_at, :null=>false
127
+
128
+ primary_key [:id]
129
+
130
+ index [:result_id]
131
+ end
132
+
133
+ create_table(:headers, :ignore_index_errors=>true) do
134
+ String :id, :size=>255, :null=>false
135
+ foreign_key :request_id, :requests, :type=>String, :size=>255
136
+ String :type, :size=>255
137
+ String :name, :size=>255
138
+ String :value, :size=>255
139
+ DateTime :created_at, :null=>false
140
+ DateTime :updated_at, :null=>false
141
+
142
+ index [:id]
143
+ index [:request_id]
144
+ end
145
+
146
+ create_table(:requests_results, :ignore_index_errors=>true) do
147
+ foreign_key :results_id, :results, :type=>String, :size=>255, :null=>false
148
+ foreign_key :requests_id, :requests, :type=>String, :size=>255, :null=>false
149
+
150
+ index [:requests_id]
151
+ index [:results_id]
152
+ end
153
+ end
154
+ end