pg_spec_helper 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/pg_spec_helper/columns.rb +4 -2
- data/lib/pg_spec_helper/models.rb +1 -1
- data/lib/pg_spec_helper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3b62da006b35dbea8daca7fdd3bd4d3e13ce98492f58d482e652b79d97b3f8f
|
4
|
+
data.tar.gz: 3f4220fc53329992304b3987305f71d06ff8522502f940d214b48835d2022502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be14d2cc0e8249d17fe46807779db16bee0aedac36be575b9f338c1b6454b11e19dc2263cd01b0c3f0b3c0602c78c6029d7ead1d5847a741e24eb24a6da8979
|
7
|
+
data.tar.gz: 505d2929712d1d6b7abde81eb9e7ffe9ff65f2a87e1e782a3df73456ba3e541dfcba6ea8792869884576cd5271028b8c76c62ce15104c62d5ae51c410b2065c6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.9.6](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.5...v1.9.6) (2023-08-24)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* create columns with default values ([91e05b8](https://github.com/craigulliott/pg_spec_helper/commit/91e05b8b14c38161965ab8e2dc1d7e869e399567))
|
9
|
+
* fixed mistake in type signatures ([a2e5f1e](https://github.com/craigulliott/pg_spec_helper/commit/a2e5f1ed897dbd7968716126ccd6a675cc7a5641))
|
10
|
+
|
3
11
|
## [1.9.5](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.4...v1.9.5) (2023-08-24)
|
4
12
|
|
5
13
|
|
@@ -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}
|
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,7 +16,7 @@ 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, :
|
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
|