[devel] Песочница и аудит для Альтератора (новая тема)

Alexey I. Froloff raorn at altlinux.org
Fri Oct 30 12:24:14 UTC 2009


On Fri, Oct 30, 2009 at 03:03:56PM +0300, Anton Farygin wrote:
> Есть большая засада с тем, что не всё хранится именно в конфигурационных 
> файлах.
> Да, и таким образом, например, не откатить создание пользователя. Тут 
> нужно подумать как следует.
Ruby on Rails database migrations:

$ cat db/migrate/002_issue_move.rb
class IssueMove < ActiveRecord::Migration
  # model removed
  class Permission < ActiveRecord::Base; end

  def self.up
    Permission.create :controller => "projects", :action => "move_issues", :description => "button_move", :sort => 1061, :mail_option => 0, :mail_enabled => 0
  end

  def self.down
    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'move_issues']).destroy
  end
end

$ rake --describe db:migrate:     
rake db:migrate:down
    Runs the "down" for a given migration VERSION.

rake db:migrate:redo
    Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.

rake db:migrate:reset
    Resets your database using your migrations for the current environment

rake db:migrate:up
    Runs the "up" for a given migration VERSION.

-- 
Regards,
Sir Raorn.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.altlinux.org/pipermail/devel/attachments/20091030/299ac93c/attachment-0001.bin>


More information about the Devel mailing list