appli 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/appli.rb +1 -1
- data/lib/commands/db.rb +12 -0
- metadata +1 -1
data/lib/appli.rb
CHANGED
data/lib/commands/db.rb
CHANGED
@@ -68,3 +68,15 @@ command "db:create", :required_args => 1 do |*label|
|
|
68
68
|
display_errors
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
desc 'Dump the database schema'
|
73
|
+
usage "appli [application] db:export {db number} {file}"
|
74
|
+
command "db:export", :required_args => 2 do |number, file|
|
75
|
+
if database = get("applications/#{@options[:application]}/databases/#{number}")['database']
|
76
|
+
dump = remote_exec("mysqldump -u #{database['username']} -p#{database['password']} -h #{database['host']['name']} #{database['name']}")
|
77
|
+
File.open(file, 'w') {|f| f.write(dump) }
|
78
|
+
puts "MySQL dump written to '#{file}'. It was #{dump.size} bytes"
|
79
|
+
else
|
80
|
+
error "Database not found with #{number}. Check 'appli [application] db:list'"
|
81
|
+
end
|
82
|
+
end
|