fx-sequence 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8915009a8dd736d970d79ef2be7ce1c7bb42afdc29e362ce0a7c9905312f3720
4
- data.tar.gz: 055d2a72ecb446d0b24ad934c03111545122cdf1f27f360cceb1ba384ee5d962
3
+ metadata.gz: d73385a8621ac337e099f90e7efb1764454f341b123feb1f06890869caeb5072
4
+ data.tar.gz: 2ff5c8fc13c5d292d59045afc7c3efbba8502667134cc52c91e51e11c8eebdd0
5
5
  SHA512:
6
- metadata.gz: 2cb072169c9679e0f493188a613cdc7ed88798958fa8ec1c4235a2fece3ca055df25cade9b90cb0193a585761487bde9a4442b318d3cd3629b6b69c735f6aabe
7
- data.tar.gz: caea3dd9dfb206fa18df1b0dc15faeba563127c50d6085620831604278cda441c22ecce55a45eee02c4765aa7e0cb2b86abcfcc48967b855346136632a2824a9
6
+ metadata.gz: 1b4dcace4770cf2fcc7c6313da8e4368a867f61b0ea884d9b0b0540359e872a8098eb846448fdc4af8de33531fa8c4c3a3467c1e96f859d318eee8d4f10b3cf5
7
+ data.tar.gz: b15a6e8b586296fab214a742b18b9ab6e49181140f9797bc3a2c573c8c0595eba16e0491a0c54bd65c8e95c1a08a39378299ee1f9dfeec1d1376f2a43637d14f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.2]
4
+
5
+ [0.1.2]: https://github.com/aevula/fx-sequence/compare/v0.1.1...v0.1.2
6
+
7
+ - Rewrote SQL-query to ignore auto-generated sequences for tables primary keys
8
+
3
9
  ## [0.1.1]
4
10
 
5
11
  [0.1.1]: https://github.com/aevula/fx-sequence/compare/v0.1.0...v0.1.1
@@ -9,11 +9,27 @@ module Fx
9
9
  class Sequences
10
10
  SEQUENCES_WITH_DEFINITIONS_QUERY = <<~SQL
11
11
  SELECT ps.relname AS name,
12
- 'CREATE SEQUENCE IF NOT EXISTS ' || ps.relname AS definition
12
+ 'CREATE SEQUENCE IF NOT EXISTS ' || ps.relname AS definition
13
13
  FROM pg_class ps
14
- JOIN pg_namespace pn ON ps.relnamespace = pn.oid
15
- WHERE pn.nspname = 'public'
16
- AND ps.relkind = 'S';
14
+ JOIN pg_namespace pn ON
15
+ ps.relnamespace = pn.oid
16
+ LEFT JOIN pg_depend pd ON
17
+ pd.objid = ps.oid AND
18
+ pd.classid = 'pg_class'::regclass AND
19
+ pd.deptype = 'a'
20
+ LEFT JOIN pg_class pt ON
21
+ pd.refobjid = pt.oid
22
+ LEFT JOIN pg_attribute pa ON
23
+ pa.attrelid = pt.oid AND
24
+ pa.attnum = pd.refobjsubid
25
+ LEFT JOIN pg_constraint pc ON
26
+ pc.conrelid = pt.oid AND
27
+ pa.attnum = ANY(pc.conkey) AND
28
+ pc.contype = 'p'
29
+ WHERE
30
+ pn.nspname = 'public' AND
31
+ ps.relkind = 'S' AND
32
+ pc.oid IS NULL;
17
33
  SQL
18
34
  private_constant :SEQUENCES_WITH_DEFINITIONS_QUERY
19
35
 
@@ -10,6 +10,10 @@ module Fx
10
10
  def drop_sequence(*args)
11
11
  record(:drop_sequence, args)
12
12
  end
13
+
14
+ def invert_create_function(args)
15
+ [:drop_function, args]
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Fx
4
4
  module Sequence
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  public_constant :VERSION
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fx-sequence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@aevula"