postgresql-backup 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +26 -0
- data/lib/tools/database.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a2a632cc3b5edbcfe9efbcccda2d26dad60d9c71442fafa13f6956bb4070799
|
4
|
+
data.tar.gz: 9c00fd45add770d9cf55d163cdf5067341943fc4e69ad62cea4b5feac2981f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2093299a3a8736fb8ed84af7011d0e8aac5731f86e4adc7fd61102fdb19e514dea2e9b150c207122e52a707ca284c71c4f8c98430926d46ea2e6d53e07af7aa3
|
7
|
+
data.tar.gz: 2ee8cf68d198f4947f599e4d9dda49a4ffbb3397133bb46f91fc1a83f9ebc25bb2ef1f7076a91b9a92d48bf2720ce7425dc6f9658e9d2407bb931db9696b8c48
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
This gem automates PostgreSQL's backup and restore in your Rails project. It will inject two rake tasks that you can use to manage your data, either by using the local system or AWS S3 storage.
|
4
4
|
|
5
|
+
The current version supports ruby 3. If you need backward compatibiliy, use [v0.0.6](https://rubygems.org/gems/postgresql-backup/versions/0.0.6) instead.
|
6
|
+
|
7
|
+
## How it looks like?
|
8
|
+
|
9
|
+
Dump:
|
10
|
+
![](https://res.cloudinary.com/ongmungazi/image/upload/v1650388791/ruby-gem/dump.gif)
|
11
|
+
|
12
|
+
Restore:
|
13
|
+
![](https://res.cloudinary.com/ongmungazi/image/upload/v1650388791/ruby-gem/restore.gif)
|
14
|
+
|
5
15
|
## Getting started
|
6
16
|
|
7
17
|
Add the gem to your Rails project:
|
@@ -139,3 +149,19 @@ Important note: if you are trying to locally restore a backup that was created i
|
|
139
149
|
Everything will work just fine, but you may come across some strange warnings, like when you try to drop the database: it will say you are droping a production database to double check if this is your intended purpose.
|
140
150
|
|
141
151
|
To prevent this, every time the rake restores a backup file it tries to replace the environment being copied into the ar_internal_metadata table with the current Rails environment. Thus, `environment production` will become `environment development`.
|
152
|
+
|
153
|
+
## I want to contribute
|
154
|
+
|
155
|
+
Feel free to open a pull request with the changes you want to make. Remember to update `CHANGELOG.md` with the change you are proposing, because once the PR is merged, it is important to show which changes are being made to the gem.
|
156
|
+
|
157
|
+
The first thing to do is to update the dependencies. If you do not have bundle installed, run `gem install bundler`. Then:
|
158
|
+
|
159
|
+
```
|
160
|
+
bundle install
|
161
|
+
```
|
162
|
+
|
163
|
+
To run the tests, we use rspec:
|
164
|
+
|
165
|
+
```
|
166
|
+
rspec
|
167
|
+
```
|
data/lib/tools/database.rb
CHANGED
@@ -57,23 +57,23 @@ module Tools
|
|
57
57
|
attr_reader :configuration
|
58
58
|
|
59
59
|
def host
|
60
|
-
@host ||= ::ActiveRecord::Base.
|
60
|
+
@host ||= ::ActiveRecord::Base.connection_db_config.configuration_hash[:host]
|
61
61
|
end
|
62
62
|
|
63
63
|
def port
|
64
|
-
@port ||= ::ActiveRecord::Base.
|
64
|
+
@port ||= ::ActiveRecord::Base.connection_db_config.configuration_hash[:port]
|
65
65
|
end
|
66
66
|
|
67
67
|
def database
|
68
|
-
@database ||= ::ActiveRecord::Base.
|
68
|
+
@database ||= ::ActiveRecord::Base.connection_db_config.configuration_hash[:database]
|
69
69
|
end
|
70
70
|
|
71
71
|
def user
|
72
|
-
::ActiveRecord::Base.
|
72
|
+
::ActiveRecord::Base.connection_db_config.configuration_hash[:username]
|
73
73
|
end
|
74
74
|
|
75
75
|
def password
|
76
|
-
@password ||= ::ActiveRecord::Base.
|
76
|
+
@password ||= ::ActiveRecord::Base.connection_db_config.configuration_hash[:password]
|
77
77
|
end
|
78
78
|
|
79
79
|
def file_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgresql-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artur Caliendo Prado
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.13.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
68
|
+
version: 3.13.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pastel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.0.3
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Automate PostgreSQL's backup and restore
|