Sha256: b244efe8c3843da6dd065170eee663ee2214dbe7269e01fc53923ba67e171a2b

Contents?: true

Size: 524 Bytes

Versions: 4

Compression:

Stored size: 524 Bytes

Contents

require 'active_record'
require 'simple_mysql_partitioning/sql'

module SimpleMySQLPartitioning
  class BasePartitioning
    attr_reader :klass, :table_name

    def initialize(klass)
      @klass = klass
      @table_name = klass.table_name
    end

    def exists?(partition_name)
      klass.connection.select_all(
        SQL.exists_sql(table_name, partition_name)
      ).to_hash.present?
    end

    def drop(partition_name)
      klass.connection.execute(SQL.parge_sql(table_name, partition_name))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_mysql_partitioning-1.0.0 lib/simple_mysql_partitioning/base_partitioning.rb
simple_mysql_partitioning-0.3.0 lib/simple_mysql_partitioning/base_partitioning.rb
simple_mysql_partitioning-0.2.1 lib/simple_mysql_partitioning/base_partitioning.rb
simple_mysql_partitioning-0.2.0 lib/simple_mysql_partitioning/base_partitioning.rb