Sha256: 8ec2a2b566450262e6e9bbec19cbe651baac0a5c5472c4814bf0d990cfbc6862
Contents?: true
Size: 521 Bytes
Versions: 7
Compression:
Stored size: 521 Bytes
Contents
namespace :db do desc 'create calendar' task create_calendar: :environment do year = 2023 d = "#{year}-01-01".to_date out = "" 368.times do if d.strftime('%Y').to_i == year+1 break end out = "#{out} ('#{d.strftime '%Y-%m-%d'}')," d = d + 1.day end out = out[0...out.length-1] out = " INSERT INTO dates (date) VALUES #{out} ;" File.write("/opt/tmp/#{year}_calendar.sql", out) `mv /opt/tmp/#{year}_calendar.sql doc/` end end
Version data entries
7 entries across 7 versions & 1 rubygems