Description:
MERGE changeset 306:307 from branch ytopc08-2 that fixes migration bug
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@308 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r161:edaacd4ec8e9 - - 4 files changed: 13 inserted, 1 deleted
@@ -6,12 +6,15 | |||||
|
6 | :full_name => 'Administrator', |
|
6 | :full_name => 'Administrator', |
|
7 | :alias => 'root') |
|
7 | :alias => 'root') |
|
8 | root.password = 'ioionrails'; |
|
8 | root.password = 'ioionrails'; |
|
9 |
|
9 | ||
|
10 | class << root |
|
10 | class << root |
|
11 | public :encrypt_new_password |
|
11 | public :encrypt_new_password |
|
|
12 | + def valid? | ||
|
|
13 | + true | ||
|
|
14 | + end | ||
|
12 | end |
|
15 | end |
|
13 |
|
16 | ||
|
14 | root.encrypt_new_password |
|
17 | root.encrypt_new_password |
|
15 |
|
18 | ||
|
16 | role = Role.create(:name => 'admin') |
|
19 | role = Role.create(:name => 'admin') |
|
17 | root.roles << role; |
|
20 | root.roles << role; |
@@ -5,12 +5,19 | |||||
|
5 | default_site.save! |
|
5 | default_site.save! |
|
6 |
|
6 | ||
|
7 | add_column :users, :site_id, :integer |
|
7 | add_column :users, :site_id, :integer |
|
8 | User.reset_column_information |
|
8 | User.reset_column_information |
|
9 |
|
9 | ||
|
10 | User.find(:all).each do |user| |
|
10 | User.find(:all).each do |user| |
|
|
11 | + | ||
|
|
12 | + class << user | ||
|
|
13 | + def valid? | ||
|
|
14 | + true | ||
|
|
15 | + end | ||
|
|
16 | + end | ||
|
|
17 | + | ||
|
11 | user.site_id = default_site.id |
|
18 | user.site_id = default_site.id |
|
12 | user.save |
|
19 | user.save |
|
13 | end |
|
20 | end |
|
14 | end |
|
21 | end |
|
15 |
|
22 | ||
|
16 | def self.down |
|
23 | def self.down |
@@ -3,9 +3,9 | |||||
|
3 | add_column :submissions, :source_filename, :string |
|
3 | add_column :submissions, :source_filename, :string |
|
4 | add_column :problems, :output_only, :boolean |
|
4 | add_column :problems, :output_only, :boolean |
|
5 | end |
|
5 | end |
|
6 |
|
6 | ||
|
7 | def self.down |
|
7 | def self.down |
|
8 | remove_column :submissions, :source_filename |
|
8 | remove_column :submissions, :source_filename |
|
9 |
- |
|
9 | + remove_column :problems, :output_only |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
@@ -1,10 +1,12 | |||||
|
1 | class AddActivatedToUsers < ActiveRecord::Migration |
|
1 | class AddActivatedToUsers < ActiveRecord::Migration |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :users, :activated, :boolean, :default => 0 |
|
3 | add_column :users, :activated, :boolean, :default => 0 |
|
4 |
|
4 | ||
|
|
5 | + User.reset_column_information | ||
|
|
6 | + | ||
|
5 | User.find(:all).each do |user| |
|
7 | User.find(:all).each do |user| |
|
6 |
|
8 | ||
|
7 | # disable validation |
|
9 | # disable validation |
|
8 | class <<user |
|
10 | class <<user |
|
9 | def valid? |
|
11 | def valid? |
|
10 | return true |
|
12 | return true |
You need to be logged in to leave comments.
Login now