Sha256: 97bb7ef149f1feb371f95ca72026305ab5c9dc76af82d2e4f21e025c01019565
Contents?: true
Size: 694 Bytes
Versions: 20
Compression:
Stored size: 694 Bytes
Contents
module EasyML def self.pending_migrations? return false unless defined?(ActiveRecord) # Get all migration files from our templates template_dir = File.expand_path("../railtie/generators/templates/migration", __dir__) template_migrations = Dir.glob(File.join(template_dir, "*.tt")).map do |f| File.basename(f, ".tt").sub(/^create_/, "") end # Get all existing migrations existing_migrations = Dir.glob(Rails.root.join("db/migrate/*_*.rb")).map do |f| File.basename(f).sub(/^\d+_create_/, "").sub(/\.rb$/, "") end # Check if any template migrations are not in existing migrations (template_migrations - existing_migrations).any? end end
Version data entries
20 entries across 20 versions & 1 rubygems