CreateInstruments.change()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 14
loc 14
rs 9.4285
1
# frozen_string_literal: true
2
3
# Migration to create instruments table
4 View Code Duplication
class CreateInstruments < ActiveRecord::Migration[5.1]
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5
  def change
6
    create_table :instruments, comment: 'Instruments table' do |t|
7
      t.string :name, null: false, unique: true, index: true
8
      t.string :version_number, null: false, default: '1.0'
9
      t.string :instrument_type, null: false, default: 'json'
10
      t.jsonb :json_content, null: false, default: '{}'
11
      t.text :csv_content, null: false, index: true, default: ''
12
      t.text :instructions, null: false, default: ''
13
      t.timestamps null: false, default: -> { 'CURRENT_TIMESTAMP' }
14
    end
15
16
    add_index :instruments, :json_content, using: :gin, name: 'instrument_json_content'
17
    add_index :instruments, %i[name version_number], unique: true
18
  end
19
end
20