Sha256: 91f4932cd8b7b30eff08a057b782d43f03a76ade9562377eaf5b4c99da21c671

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

class CreateCloudHelpWorkflowAssociations < ActiveRecord::Migration[6.0]
    def change
        table_base_structure = JSON.parse(File.read(Rails.root.join("db","structure","00000203_workflow_associations.json")))
        create_table :cloud_help_workflow_associations do |t|
            table_base_structure.each do |column|
                t.send(
                    column["type"].parameterize.underscore.to_sym,
                    column["name"].parameterize.underscore.to_sym
                )
            end

            # Specific fields to which you can associate a workflow with
            t.bigint :ticket_type
            t.bigint :ticket_category

            t.timestamps
        end
        
        add_index :cloud_help_workflow_associations, :ticket_type,      name: "help_workflow_associations_ticket_types"
        add_index :cloud_help_workflow_associations, :ticket_category,  name: "help_workflow_associations_ticket_categories"

        add_reference(
            :cloud_help_workflow_associations, 
            :workflow, 
            foreign_key: { to_table: :cloud_help_workflows}, 
            index: { name: "help_workflow_associations_workflows" }
        )
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lesli_help-0.1.0 db/tables/0702020310_create_cloud_help_workflow_associations.rb