Remove data migrations

This commit is contained in:
Martin Lensment 2015-04-29 16:51:11 +03:00
parent 35b8ec6c91
commit 350cae621a
8 changed files with 0 additions and 33 deletions

View file

@ -7,9 +7,5 @@ class CreateAccounts < ActiveRecord::Migration
t.timestamps
end
Registrar.all.each do |x|
Account.create(registrar_id: x.id, account_type: Account::CASH)
end
end
end

View file

@ -1,10 +1,5 @@
class AddReferenceNoToRegistrar < ActiveRecord::Migration
def change
add_column :registrars, :reference_no, :string
Registrar.all.each do |x|
x.generate_iso_11649_reference_no
x.save
end
end
end

View file

@ -1,10 +1,5 @@
class FixAccountBalancesToDecimal < ActiveRecord::Migration
def change
Account.all.each do |x|
x.balance = 0.0 unless x.balance
x.save
end
change_column :accounts, :balance, :decimal, null: false, default: 0
end
end

View file

@ -1,7 +1,5 @@
class AddCurrencyToAccount < ActiveRecord::Migration
def change
add_column :accounts, :currency, :string
Account.update_all(currency: 'EUR')
end
end

View file

@ -1,20 +1,5 @@
class SaveLegalDocsToDisk < ActiveRecord::Migration
def change
add_column :legal_documents, :path, :string
LegalDocument.all.each do |x|
path = nil
loop do
rand = SecureRandom.random_number.to_s.last(4)
next if rand.to_i == 0 || rand.length < 4
path = "#{ENV['legal_documents_dir']}/#{Time.zone.now.to_formatted_s(:number)}_#{rand}.#{x.document_type}"
break unless File.file?(path)
end
body = x.read_attribute('body')
File.open(path, 'wb') { |f| f.write(Base64.decode64(body)) }
x.update_column('path', path)
end
remove_column :legal_documents, :body, :text
end
end

View file

@ -1,6 +1,5 @@
class AddNumberToInvoices < ActiveRecord::Migration
def change
add_column :invoices, :number, :integer
Invoice.all.each(&:save)
end
end

View file

@ -1,6 +1,5 @@
class AddSumCacheToInvoice < ActiveRecord::Migration
def change
add_column :invoices, :sum_cache, :decimal
Invoice.all.each(&:save)
end
end