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:
- 2042 Bytes
1 | ######################################################################## |
2 | # File:: 20110130112503_create_polls.rb |
3 | # (C):: Hipposoft 2011 |
4 | # |
5 | # Purpose:: Create or destroy the 'polls' table. |
6 | # ---------------------------------------------------------------------- |
7 | # 30-Jan-2011 (ADH): Created. |
8 | ######################################################################## |
9 | |
10 | class CreatePolls < ActiveRecord::Migration |
11 | def self.up |
12 | create_table :polls do |t| |
13 | |
14 | # See "prepare_model_for_translation" in "translations_controller.rb" and |
15 | # the Poll model. The following is equivalent to: |
16 | # |
17 | # t.string :title_<default-locale-code>, :limit => Poll::MAXLEN_TITLE |
18 | # t.text :body_<default-locale-code> |
19 | |
20 | t.column Poll.column_name_localized( 'title', I18n.default_locale() ).to_sym, |
21 | Poll.column_type( :title ), |
22 | Poll.column_options( :title ) |
23 | |
24 | t.column Poll.column_name_localized( 'description', I18n.default_locale() ).to_sym, |
25 | Poll.column_type( :description ), |
26 | Poll.column_options( :description ) |
27 | |
28 | t.integer :votes |
29 | |
30 | # Link back to the administrator who created this poll and the currency |
31 | # the poll supports for donations. |
32 | |
33 | t.belongs_to :user # => integer user_id |
34 | t.belongs_to :currency # => integer currency_id |
35 | |
36 | # For the Workflow gem (see config/environment.rb). |
37 | |
38 | t.string :workflow_state, :null => false, :limit => Poll::MAXLEN_STATE |
39 | |
40 | # A high accuracy count of the running total in this poll has to be |
41 | # kept. If the poll gets closed by expiry, the amount has to be |
42 | # distributed amongst any other live polls. A cache column float value |
43 | # is kept for sort and search purposes. |
44 | |
45 | t.string :total_integer, :null => false |
46 | t.string :total_fraction, :null => false |
47 | t.float :total_for_sorting |
48 | |
49 | t.timestamps |
50 | end |
51 | |
52 | add_index :polls, :user_id |
53 | add_index :polls, :currency_id |
54 | |
55 | end |
56 | |
57 | def self.down |
58 | drop_table :polls |
59 | end |
60 | end |