lib/localtower/status.rb in localtower-0.4.1 vs lib/localtower/status.rb in localtower-0.4.2
- old
+ new
@@ -5,26 +5,20 @@
names = files.map do |file_full_path|
file_full_path.split("/")[-1]
end
- results = []
+ db_migrations = ActiveRecord::Base.connection.execute("select * from schema_migrations;").map { |e| e["version"].to_s }.sort.reverse
- migrations = ActiveRecord::Base.connection.execute("select * from schema_migrations;").map { |e| e["version"].to_s }.sort.reverse
+ names.map do |name|
+ time = name.split("_")[0]
+ status = db_migrations.include?(time) ? :done : :todo
- names.each do |name|
- number = name.split("_")[0]
-
- status = migrations.include?(number) ? 1 : 0
-
- data = {
+ {
"name" => name,
+ "time" => time,
"status" => status,
}
-
- results << data
end
-
- results
end
end
end