Module: Migration::Helpers

Defined in:
lib/migration/helpers.rb

Class Method Summary collapse

Class Method Details

.existing_site?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/migration/helpers.rb', line 15

def self.existing_site?
  site_created_at < 1.hour.ago
end

.new_site?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/migration/helpers.rb', line 19

def self.new_site?
  !old_site?
end

.site_created_atObject



5
6
7
8
9
10
11
12
13
# File 'lib/migration/helpers.rb', line 5

def self.site_created_at
  result = DB.query_single <<~SQL
    SELECT created_at
    FROM schema_migration_details
    ORDER BY created_at
    LIMIT 1
  SQL
  result.first
end