Jump to navigation Jump to search
1,258 bytes removed ,  13:56, 10 November 2010
=== Gitorious environments Database tweaks ===
We do not have root on Put the following aliases To make runtime changes in your~/.bashrc to quickly switch to the Gitorious productiondatabase, test and developmentenvironmentsfollow regular Rails workflow - run {{Code|scripts/console}}:
alias cd /srv/gitorious='sudo su - gitorious'/app alias gittest='sudo su - gittest' alias gitdevu gitorious RAILS_ENV='sudo su - gitdev' alias db='mysql -h -u sugarlabs_git -p sugarlabs_git_dev'production script/console
=== Get a MySQL prompt ===type "db" at the promptIt is regular Ruby console and all feature like {{Code|TAB}} completion work. To tweak Gitorious data, then give the db passwordfrom ~just use its [ model classes], e.g.yml:
# search of particular object by its attributes user =User.find_by_login("user") project == Change User.find_by_title("project owner ===") # change object attributes UPDATE projects SET user_idproject.owner =User.find_by_email(SELECT id FROM users WHERE login='jasg'"foo@bas") WHERE slug='labyrinth';! # destroy object and all its dependencies user.destroy
=== Change repo owner Tips === UPDATE repositories SET user_id=(SELECT id FROM users WHERE login='jasg') WHERE name='mainline' AND project_id=(SELECT id FROM projects WHERE title='poll');
=== Add committer === INSERT INTO committerships SET user_id=(select id from users where login='bernie'), repository_id=(SELECT id FROM repositories where project_id=(SELECT id FROM projects WHERE title='sugar') AND name='mainline'), kind=2, created_at=NOW(), updated_at=NOW(); === Hijack account to # reset user password === update users set emailuser ='YOUREMAIL' where login='USER'; Then make Gitorious send you a password reset emailUser.find_by_login("user") update users set emailpassword_key ='OLDEMAIL' where login='USER'; === Zapping a user account === WARNING: to kill a user account, make sure you also remove *ALL* its associated recordsfrom all tables, or Gitorious will break in non-obvious ways SELECT id FROM users WHERE login='demian'; DELETE FROM committers WHERE user_id=666; DELETE FROM events WHERE user_id=666; DELETE FROM comments WHERE user_id=666; DELETE FROM merge_requests WHERE user_id=666;forgot_password! DELETE FROM repositories WHERE user_id=666; DELETE FROM projects WHERE user_id=666; NOTE: tch pointed out that Rails applications often provide a higher-level methodin class User which deletes the record and its associated entriesMailer. Howeverdeliver_forgotten_password(user, ourdeployed version of Gitorious does not seem to provide it. === Restart gitorious after code/config changes === touch tmp/restart.txtpassword_key)
== Upgrade notes ==
Upgrade will be triggered on every puppet session (if there is such need), vcs repository will be rebased to the HEAD commit with all related changes like database migration.

Navigation menu