pg_spec_helper 1.9.5 → 1.9.7

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
  SHA256:
3
- metadata.gz: e8d62acbd1ea6d5a00f4255938077a50e58f4f80bc014dc43c5bc373d646a162
4
- data.tar.gz: 3dabe0757237b7280bd22c2bb244936aabbe1ad14a080e5887348b5951167c45
3
+ metadata.gz: 8e7cbe1ac44df56e5c441603bed08618176afe0a5078e59dfd73b46344ca0905
4
+ data.tar.gz: aecb8f4db0504277d433a222999224b4a797eceae3e296d758bada2aa065e530
5
5
  SHA512:
6
- metadata.gz: ae093650221ef8581d6c4e4a6d75ce9d1451bf2c1af6a2fbd033505780affd2c879bd1811ebc4b4aff594e2e0bd4dd52eb616556790889da47645dd20fddfb03
7
- data.tar.gz: cb502feb94c7511dd8670de9114f6509c5d09b95804a7dd5d36b40037dee771fc7a46f9cf64c07123464604bcac62bd8634dfae12919cd6fd6d0ae24298dddad
6
+ metadata.gz: b20b76783e605290fe3878ca214d747e46f5e928ce737ed627c6d9a4f1e5b81f1f20a71f6df3d5a237c6181db928140c8cef4d26360dafb5aed9e52dd16109e6
7
+ data.tar.gz: 448c1f7e682e780ebbbdf5f3139e6905e347dc711fe396909a2af0314dcd237831900bdae409350f6b65f1f91b2b5076a831cbcf36039522e2c97cf19e518f7e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.7](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.6...v1.9.7) (2023-08-24)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * ensuring uniqueness for primary_keys ([6179b46](https://github.com/craigulliott/pg_spec_helper/commit/6179b46f683adf08836c7193dd63711fe2533778))
9
+
10
+ ## [1.9.6](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.5...v1.9.6) (2023-08-24)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * create columns with default values ([91e05b8](https://github.com/craigulliott/pg_spec_helper/commit/91e05b8b14c38161965ab8e2dc1d7e869e399567))
16
+ * fixed mistake in type signatures ([a2e5f1e](https://github.com/craigulliott/pg_spec_helper/commit/a2e5f1ed897dbd7968716126ccd6a675cc7a5641))
17
+
3
18
  ## [1.9.5](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.4...v1.9.5) (2023-08-24)
4
19
 
5
20
 
@@ -6,11 +6,13 @@ class PGSpecHelper
6
6
  end
7
7
 
8
8
  # create a column for the provided table
9
- def create_column schema_name, table_name, column_name, type, null = true
9
+ def create_column schema_name, table_name, column_name, type, null = true, default = nil
10
10
  # note the `type` is safe from sql_injection due to the validation above
11
11
  connection.exec(<<~SQL)
12
12
  ALTER TABLE #{connection.quote_ident schema_name.to_s}.#{connection.quote_ident table_name.to_s}
13
- ADD COLUMN #{connection.quote_ident column_name.to_s} #{type} #{null ? "" : "NOT NULL"}
13
+ ADD COLUMN #{connection.quote_ident column_name.to_s} #{type}
14
+ #{null ? "" : "NOT NULL"}
15
+ #{default ? "DEFAULT #{default}" : ""}
14
16
  SQL
15
17
  end
16
18
 
@@ -16,11 +16,11 @@ class PGSpecHelper
16
16
  # create the table
17
17
  create_table schema_name, table_name
18
18
  # create the standard columns
19
- create_column schema_name, table_name, :id, :serial
19
+ create_column schema_name, table_name, :id, :uuid, null: false, default: "uuid_generate_v4()"
20
20
  create_column schema_name, table_name, :created_at, :timestamp
21
21
  create_column schema_name, table_name, :updated_at, :timestamp
22
22
  # add the primary key
23
- create_primary_key schema_name, table_name, [:id], :pk
23
+ create_primary_key schema_name, table_name, [:id], :"#{table_name}_pkey"
24
24
  # execute the optional block
25
25
  if block
26
26
  this = self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class PGSpecHelper
4
- VERSION = "1.9.5"
4
+ VERSION = "1.9.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott