Changeset - 12eb1a018199
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 15 years ago 2010-12-11 04:39:13
marcin@python-works.com
db migrations:
Added patch for default user
2 files changed with 26 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -3,7 +3,8 @@
 
    rhodecode.lib.db_manage
 
    ~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Database creation, and setup module for RhodeCode
 
    Database creation, and setup module for RhodeCode. Used for creation
 
    of database as well as for migration operations
 
    
 
    :created_on: Apr 10, 2010
 
    :author: marcink
 
@@ -117,6 +118,25 @@ class DbManage(object):
 
            self.sa.rollback()
 
            raise
 

	
 
    def fix_default_user(self):
 
        """Fixes a old default user with some 'nicer' default values,
 
        used mostly for anonymous access
 
        """
 
        def_user = self.sa.query(User)\
 
                .filter(User.username == 'default')\
 
                .one()
 

	
 
        def_user.name = 'Anonymous'
 
        def_user.lastname = 'User'
 
        def_user.email = 'anonymous@rhodecode.org'
 

	
 
        try:
 
            self.sa.add(def_user)
 
            self.sa.commit()
 
        except:
 
            self.sa.rollback()
 
            raise
 

	
 

	
 

	
 
    def admin_prompt(self, second=False):
rhodecode/lib/dbmigrate/__init__.py
Show inline comments
 
@@ -81,14 +81,17 @@ class UpgradeDb(BasePasterCommand):
 
        self.notify_msg('Schema upgrade completed')
 

	
 
        #we need to make now some extra operations into database
 
        self.notify_msg('Prociding with database updates')
 
        self.notify_msg('Propagating database updates')
 

	
 
        dbmanage = DbManage(log_sql=True, dbconf=db_uri,
 
                            root=config['here'], tests=False)
 

	
 
        self.notify_msg('Patching repo paths for newer version of rhodecode')
 
        self.notify_msg('Patching repo paths for newer version of RhodeCode')
 
        dbmanage.fix_repo_paths()
 

	
 
        self.notify_msg('Patching default user of RhodeCode')
 
        dbmanage.fix_default_user()
 

	
 
        self.notify_msg('Changing ui settings')
 
        dbmanage.create_ui_settings()
 

	
0 comments (0 inline, 0 general)