Sha256: 5d8151c8245c06536293e78edac104b15435a2a4c5a3dac600d22ce6f3f33710

Contents?: true

Size: 774 Bytes

Versions: 20

Compression:

Stored size: 774 Bytes

Contents

module Spider; module Migrations

    class DropElement < IrreversibleMigration

        def initialize(model, element, options={})
            @model = model
            @element = element
            @options = options
        end

        def run
            field = @options[:field_name]
            if !field
                schema_field = @model.mapper.schema.field(@element)
                field = schema_field.name if schema_field
            end
            field ||= @model.mapper.storage.column_name(@element)
            desc = @model.mapper.storage.describe_table(@model.mapper.schema.table)
            if desc[:columns][field]
                @model.mapper.storage.drop_field(@model.mapper.schema.table, field)
            end
        end

    end

end; end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spiderfw-1.0.1 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-1.0.0 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.39 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.38 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.37 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.35 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.34 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.33 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.32 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.31 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.30 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.29 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.28 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.27 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.26 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.26.pre1 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.25 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.24 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.23 lib/spiderfw/model/migrations/drop_element.rb
spiderfw-0.6.22 lib/spiderfw/model/migrations/drop_element.rb