safe-pg-migrations 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064f4f95d22160ab489fbe40a4af338110144c74
|
4
|
+
data.tar.gz: 6c7e864e8b88251d9c3defb93c986af186e19a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68157b6bbaf2f8b5a363f0796e7e98a5cfa19ccd6e6bdc2981e4b523dbc24b63fda023807c0d13964da544f1323d186ce180265e0f3f9e66dd6faa193d601baa
|
7
|
+
data.tar.gz: 7b0cc78b1552683538548f6ab57b05154f80009f022073c4c993d4226f1cda6f91576f0a090493b7f5f4dc61073ad6aaf1d63100e78ec984ee25c89d2b7770f3
|
data/README.md
CHANGED
@@ -118,7 +118,7 @@ If a statement fails with a lock timeout, **Safe PG Migrations** will try to tel
|
|
118
118
|
|
119
119
|
```bash
|
120
120
|
bundle
|
121
|
-
psql -h localhost -c 'CREATE DATABASE safe_pg_migrations_test'
|
121
|
+
psql -h localhost -U postgres -c 'CREATE DATABASE safe_pg_migrations_test'
|
122
122
|
rake test
|
123
123
|
```
|
124
124
|
|
@@ -126,6 +126,7 @@ rake test
|
|
126
126
|
|
127
127
|
- [Matthieu Prat](https://github.com/matthieuprat)
|
128
128
|
- [Romain Choquet](https://github.com/rchoquet)
|
129
|
+
- [Paul-Etienne Coisne](https://github.com/coisnepe)
|
129
130
|
|
130
131
|
## License
|
131
132
|
|
@@ -12,6 +12,20 @@ module SafePgMigrations
|
|
12
12
|
super
|
13
13
|
end
|
14
14
|
|
15
|
+
def remove_column(table_name, column_name, type = nil, options = {})
|
16
|
+
return super if column_exists?(table_name, column_name)
|
17
|
+
|
18
|
+
SafePgMigrations.say("/!\\ Column '#{column_name}' not found on table '#{table_name}'. Skipping statement.", true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove_index(table_name, options = {})
|
22
|
+
index_name = options.key?(:name) ? options[:name].to_s : index_name(table_name, options)
|
23
|
+
|
24
|
+
return super if index_name_exists?(table_name, index_name)
|
25
|
+
|
26
|
+
SafePgMigrations.say("/!\\ Index '#{index_name}' not found on table '#{table_name}'. Skipping statement.", true)
|
27
|
+
end
|
28
|
+
|
15
29
|
private
|
16
30
|
|
17
31
|
def index_valid?(index_name)
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module SafePgMigrations
|
4
4
|
module StatementRetrier
|
5
5
|
RETRIABLE_SCHEMA_STATEMENTS = %i[
|
6
|
-
add_column
|
7
|
-
change_column_null add_index
|
6
|
+
add_column add_foreign_key remove_foreign_key change_column_default
|
7
|
+
change_column_null add_index remove_index remove_column
|
8
8
|
].freeze
|
9
9
|
|
10
10
|
RETRIABLE_SCHEMA_STATEMENTS.each do |method|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe-pg-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Prat
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-11-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|