class CreateEffectiveCpd < ActiveRecord::Migration[6.0] def change create_table <%= @cpd_cycles_table_name %> do |t| t.string :title t.datetime :start_at t.datetime :end_at t.integer :required_score t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_categories_table_name %> do |t| t.string :title t.integer :position t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_activities_table_name %> do |t| t.references :cpd_category t.string :title t.integer :position t.string :amount_label t.string :amount2_label t.boolean :requires_upload_file, default: false t.boolean :requires_date, default: false t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_rules_table_name %> do |t| t.references :cpd_cycle t.integer :ruleable_id t.string :ruleable_type t.text :credit_description t.string :formula t.decimal :max_credits_per_cycle t.integer :max_cycles_can_carry_forward t.boolean :unavailable, default: false t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_special_rules_table_name %> do |t| t.references :cpd_cycle t.decimal :max_credits_per_cycle t.string :category t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_special_rule_mates_table_name %> do |t| t.references :cpd_rule t.references :cpd_special_rule t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_statement_activities_table_name %> do |t| t.references :cpd_statement t.references :cpd_activity t.references :cpd_category t.references :original t.references :cpd_cycle t.integer :user_id t.string :user_type t.decimal :amount, precision: 10, scale: 2 t.decimal :amount2, precision: 10, scale: 2 t.date :date t.text :description t.decimal :carry_over, precision: 10, scale: 2 t.decimal :score, precision: 10, scale: 2 t.decimal :carry_forward, precision: 10, scale: 2 t.text :reduced_messages t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_statements_table_name %> do |t| t.references :cpd_cycle t.integer :user_id t.string :user_type t.string :token t.decimal :score, precision: 10, scale: 2 t.boolean :confirm_read t.boolean :confirm_factual t.boolean :confirm_readonly t.datetime :submitted_at t.text :wizard_steps t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_levels_table_name %> do |t| t.string :title t.text :determinations t.text :recommendations t.boolean :conflict_of_interest t.boolean :can_request_exemption t.boolean :can_request_extension t.integer :days_to_submit t.integer :days_to_review t.integer :days_to_declare_conflict t.integer :days_to_request_exemption t.integer :days_to_request_extension t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_level_sections_table_name %> do |t| t.references :cpd_audit_level t.string :title t.integer :position t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_level_questions_table_name %> do |t| t.references :cpd_audit_level t.references :cpd_audit_level_section t.text :title t.string :category t.boolean :required, default: true t.integer :position t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_level_question_options_table_name %> do |t| t.references :cpd_audit_level_question, index: false t.text :title t.integer :position t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audits_table_name %> do |t| t.references :cpd_audit_level t.integer :user_id t.string :user_type t.date :due_date t.date :notification_date t.date :extension_date t.boolean :ignore_deadlines, default: false t.string :determination t.boolean :conflict_of_interest t.text :conflict_of_interest_reason t.boolean :exemption_request t.text :exemption_request_reason t.boolean :extension_request t.text :extension_request_reason t.date :extension_request_date t.datetime :started_at t.datetime :submitted_at t.datetime :reviewed_at t.datetime :closed_at t.string :status t.text :status_steps t.text :wizard_steps t.string :token t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_reviews_table_name %> do |t| t.references :cpd_audit_level t.references :cpd_audit t.integer :user_id t.string :user_type t.date :due_date t.text :comments t.string :recommendation t.boolean :conflict_of_interest t.text :conflict_of_interest_reason t.datetime :submitted_at t.string :status t.text :status_steps t.text :wizard_steps t.string :token t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_review_items_table_name %> do |t| t.references :cpd_audit_review t.integer :item_id t.string :item_type t.string :recommendation t.text :comments t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_responses_table_name %> do |t| t.references :cpd_audit t.references :cpd_audit_level_question t.references :cpd_audit_level_section t.date :date t.string :email t.integer :number t.text :long_answer t.text :short_answer t.datetime :updated_at t.datetime :created_at end create_table <%= @cpd_audit_response_options_table_name %> do |t| t.references :cpd_audit_response t.references :cpd_audit_level_question_option, index: false t.datetime :updated_at t.datetime :created_at end end end