]> source.dussan.org Git - sonarqube.git/commitdiff
Fix db migration : do not use faux models for User
authorSimon Brandhof <simon.brandhof@gmail.com>
Thu, 16 Feb 2012 10:22:20 +0000 (11:22 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Thu, 16 Feb 2012 10:23:12 +0000 (11:23 +0100)
sonar-server/src/main/webapp/WEB-INF/db/migrate/087_create_user_roles.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/088_create_default_users_and_groups.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/089_set_default_project_roles.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/257_add_active_field_on_users.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt

index a04aecba554e59958dbc20106a8f000e4a2ca09d..a30fe7b7bd1646ec1da0f2312c7de213a0b8668a 100644 (file)
@@ -28,8 +28,4 @@ class CreateUserRoles < ActiveRecord::Migration
     add_index "user_roles", "user_id", :name => 'user_roles_user'
          add_index "user_roles", "resource_id", :name => 'user_roles_resource'
   end
-
-  def self.down
-         drop_table :user_roles
-  end
 end
index 04cfe08ec2153fb159935ce71a2ff412c897d5bf..881eca6a98cf42cad47db5dc1d01332ad2900489 100644 (file)
 # sonar 2.0
 class CreateDefaultUsersAndGroups < ActiveRecord::Migration
 
+  class GroupRole < ActiveRecord::Base
+  end
+
+  class Group < ActiveRecord::Base
+  end
+
   def self.up
+    Group.reset_column_information
+    GroupRole.reset_column_information
+
        create_administrators
     create_users
   end
index 70cf1c1992fc6ededb093b4f38926f7ae7a3c0e1..2a7eeaec0fb0394447976c8a281e10561e593a43 100644 (file)
 #
 # sonar 2.0
 class SetDefaultProjectRoles < ActiveRecord::Migration
-  
+
+  class Group < ActiveRecord::Base
+  end
+
+  class GroupRole < ActiveRecord::Base
+  end
+
   def self.up
+    Group.reset_column_information
+    GroupRole.reset_column_information
+
     administrators=Group.find_by_name('sonar-administrators')
     users=Group.find_by_name('sonar-users')
 
index 2a7da8f1afd4bf9fafd360244c5722e21d716a78..027bcab8f6e516b0f6af406a80de840d59ba441a 100644 (file)
@@ -23,9 +23,6 @@
 #
 class AddActiveFieldOnUsers < ActiveRecord::Migration
 
-  class User < ActiveRecord::Base
-  end
-
   def self.up
     add_column 'users', 'active', :boolean, :null => true, :default => true
 
index 1c3a2d850bbf9aaa7b9badd11e7397eaa195457e..8d58907d3240dbefaf3bf787193e0a854b54942e 100644 (file)
@@ -28,6 +28,7 @@ RECOMMENDATIONS
 
 * Use faux models when touching rows (SELECT/INSERT/UPDATE/DELETE). See http://guides.rubyonrails.org/migrations.html#using-models-in-your-migrations
   for more details.
+  IMPORTANT : do not use faux models for User. The algorithm to encrypt passwords is required during migrations.
 
   class MyMigration < ActiveRecord::Migration
     # This is the faux model. It only maps columns. No functional methods.