Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 390
- Log:
Initial import of Canvass, a donations-based poll application.
- Author:
- rool
- Date:
- Mon Mar 21 14:58:04 +0000 2011
- Size:
- 1832 Bytes
1 | ######################################################################## |
2 | # File:: 20110130160059_create_invoice_numbers.rb |
3 | # (C):: Hipposoft 2010, 2011 |
4 | # |
5 | # Purpose:: Create or destroy the 'invoice_numbers' table. This actually |
6 | # holds a singleton which records a most recently used |
7 | # invoice number (or zero at the very beginning). The model |
8 | # code related to this table uses transactions and locking to |
9 | # ensure that the integer invoice number is monotonically |
10 | # increased with total thread-safety so that successive |
11 | # invoices will get successive numbers without fail. The table |
12 | # and model arise from UK VAT invoice numbering requirements. |
13 | # ---------------------------------------------------------------------- |
14 | # 19-Mar-2010 (ADH): Created. |
15 | # 30-Jan-2011 (ADH): Imported from Artisan. |
16 | ######################################################################## |
17 | |
18 | require 'yaml' |
19 | require 'active_record/fixtures' |
20 | |
21 | class CreateInvoiceNumbers < ActiveRecord::Migration |
22 | def self.up |
23 | create_table 'invoice_numbers' do | t | |
24 | t.integer :last_number_used, :null => false, :default => 0 |
25 | end |
26 | |
27 | # Define the default singleton. |
28 | |
29 | directory = File.join( RAILS_ROOT, 'test', 'fixtures' ) |
30 | Fixtures.create_fixtures( directory, 'invoice_numbers' ) |
31 | end |
32 | |
33 | # In a production system, dropping the invoice numbers table is fairly |
34 | # suicidal since you'll lose the record of the last used invoice number |
35 | # and new invoices will reuse numbers already issued. Provided you take |
36 | # care to manually record the last used invoice number beforehand and |
37 | # restore this in an offline system before going back online, though, |
38 | # you should be able to get away with it. |
39 | # |
40 | def self.down |
41 | drop_table 'invoice_numbers' |
42 | end |
43 | end |