include/drivers/mysql/mysql_index.rb in baza-0.0.15 vs include/drivers/mysql/mysql_index.rb in baza-0.0.16
- old
+ new
@@ -1,6 +1,6 @@
-class Baza::Driver::Mysql::Index
+class Baza::Driver::Mysql::Index < Baza::Index
attr_reader :args, :columns
def initialize(args)
@args = args
@columns = []
@@ -51,26 +51,18 @@
}
end
#Returns true if the index is a unique-index.
def unique?
- if @args[:data][:Index_type] == "UNIQUE"
+ if @args[:data][:Index_type] == "UNIQUE" || @args[:data][:Non_unique].to_i == 0
return true
else
return false
end
end
#Returns true if the index is a primary-index.
def primary?
return true if @args[:data][:Key_name] == "PRIMARY"
return false
- end
-
- def to_s
- return "#<Baza::Driver::Mysql::Index name: \"#{name}\", columns: #{@columns}, primary: #{primary?}, unique: #{unique?}>"
- end
-
- def inspect
- to_s
end
end