Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattetti/ar-backup
Active Record backup is a Rails plugin which lets you backup your database schema and content in a schema.rb file and fixtures.
https://github.com/mattetti/ar-backup
Last synced: 3 months ago
JSON representation
Active Record backup is a Rails plugin which lets you backup your database schema and content in a schema.rb file and fixtures.
- Host: GitHub
- URL: https://github.com/mattetti/ar-backup
- Owner: mattetti
- License: mit
- Created: 2008-03-05T06:05:03.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2008-03-26T19:48:01.000Z (almost 17 years ago)
- Last Synced: 2024-10-31T06:42:00.638Z (3 months ago)
- Language: Ruby
- Homepage: http://code.google.com/p/ar-backup/
- Size: 80.1 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
Awesome Lists containing this project
README
=ActiveRecord-backup
Using rake tasks, dump your schema and data into yml files. One folder gets created per SVN revision. You can then simply load any previous data using rake.
prerequisite: Your project must be under SVN.
==Usage:
rake backup:db:dump # create a backup folder containing your db schema and content data (see backup/{env}/build_{build number})
rake backup:db:extract_content # Create YAML fixtures from your DB content
rake backup:db:extract_schema # Dump the db schema
rake backup:db:load # load your backed up data from a previous build. rake backup:db:load BUILD=1182 or rake backup:db:load BUILD=1182 DUMP_ENV=production==Example
rake backup:db:dump
rake backup:db:load BUILD=2547
==Capistrano 2 usage example
(you first need to create a backup folder)
set :backup_dir, "#{deploy_to}/backup"
before :deploy do
db.backup
db.move_backup
endnamespace :db do
desc 'create the production database'
task :create do
run "cd #{current_release} && rake db:create RAILS_ENV=production"
enddesc 'dump the database schema and content'
task :backup do
run "cd #{current_release} && rake backup:db:dump RAILS_ENV=production"
enddesc 'timestamp the backup file'
task :move_backup do
run "cd #{current_release} && mv backup/production #{backup_dir}/production_#{Time.now.strftime("%Y-%m-%d_%H-%M")}"
end
end==Contributors
Cyril Mougel : [email protected] (ar_backup windows compatible and the revision number is parsed in a more efficient way)Copyright (c) 2007 Matt Aimonetti, released under the MIT license