ey_cloud_server 1.3.1 → 1.4.5.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +0,0 @@
1
- module EY::Flex
2
- class MysqlDatabase < DatabaseEngine
3
- register_as 'mysql'
4
-
5
- def dump_database(name, io)
6
- single_transaction = db_has_myisam?(name) ? '' : '--single-transaction'
7
- Open4.spawn ["mysqldump -u#{dbuser} #{password_option} #{single_transaction} #{name} | gzip -c"], :stdout => io
8
- end
9
-
10
- def db_has_myisam?(name)
11
- query = "SELECT 1 FROM information_schema.tables WHERE table_schema='#{name}' AND engine='MyISAM' LIMIT 1;"
12
- %x{mysql -u #{dbuser} #{password_option} -N -e"#{query}"}.strip == '1'
13
- end
14
-
15
- def restore_database(name, io)
16
- Open4.spawn ["gzip -dc | mysql -u#{dbuser} #{password_option} #{name}"], :stdin => io
17
- end
18
-
19
- def password_option
20
- dbpass.blank? ? "" : "-p'#{dbpass}'"
21
- end
22
- end
23
- end
@@ -1,14 +0,0 @@
1
- module EY::Flex
2
- class PostgresqlDatabase < DatabaseEngine
3
- register_as 'postgresql'
4
-
5
- def dump_database(name, io)
6
- Open4.spawn ["PGPASSWORD='#{dbpass}' pg_dump -h localhost --clean --no-owner --no-privileges -U#{dbuser} #{name}"], :stdout => io
7
- end
8
-
9
- def restore_database(name, io)
10
- Open4.spawn ["PGPASSWORD='#{dbpass}' createdb -h localhost -U#{dbuser} #{name}"], :stdin => io, :raise => false
11
- Open4.spawn ["PGPASSWORD='#{dbpass}' psql -h localhost -U#{dbuser} #{name}"], :stdin => io
12
- end
13
- end
14
- end