time_range_uniqueness 1.0.1 → 1.0.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +13 -2
- data/lib/time_range_uniqueness/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc737c44b6dbbf13c6781eef86f089832aaf04cda0a50c0d513f91e19536f600
|
|
4
|
+
data.tar.gz: 1be53b987bdc21f730b2ace9ea9aa9478eef92387ecdc6508a6bfad68f90d4ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6d32eb4c17f95d7d0815e692f09eed56d62aeb259a9c3b05e70fa2c78dfc59ac89fbd8127dc9bf33e29e8a5c5d2382ae21fdf07dd6ae906d9b36be3a878c4e5
|
|
7
|
+
data.tar.gz: 889b032899cbdc7cc3fc2cb73d05b593d438ecf112561dca2926a715c713d26cf92e5224cc85a9470b55c3404426484a5c66633ad8e716f7a13365e17c910bda
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.0.2] - 2026-05-31
|
|
4
|
+
|
|
5
|
+
- Update the README to match the current behavior: document the Ruby >= 3.2 and
|
|
6
|
+
ActiveRecord >= 7.1 requirements, correct the migration example's version stamp, clarify
|
|
7
|
+
that `validates_time_range_uniqueness` is available on all models, and list the
|
|
8
|
+
validation/constraint behavior added in 1.0.0 and 1.0.1.
|
|
9
|
+
|
|
3
10
|
## [1.0.1] - 2026-05-31
|
|
4
11
|
|
|
5
12
|
- Fix the overlap validation to treat a `NULL` scope value as never-conflicting, matching
|
data/README.md
CHANGED
|
@@ -11,6 +11,17 @@ It adds support for creating exclusion constraints on PostgreSQL `tstzrange` col
|
|
|
11
11
|
- **Migration Additions**: Adds a custom method for generating exclusion constraints on time range columns in PostgreSQL using `tstzrange`.
|
|
12
12
|
- **Model Additions**: Adds validation to ensure time ranges do not overlap with existing records.
|
|
13
13
|
- Supports optional scoping to ensure time ranges are unique within specified contexts (e.g., unique per event name).
|
|
14
|
+
- Honors the time range's bound inclusivity (`..` vs `...`) so the model validation agrees with the database-level exclusion constraint.
|
|
15
|
+
- Treats a `NULL` scope value as never-conflicting, matching PostgreSQL's exclusion-constraint semantics (`NULL = NULL` is never true).
|
|
16
|
+
- Works with models that use a composite primary key.
|
|
17
|
+
- Keeps generated constraint names within PostgreSQL's 63-character identifier limit, and raises if a custom `:name` exceeds it.
|
|
18
|
+
- Quotes table and column identifiers in the generated migration and validation SQL.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Ruby >= 3.2
|
|
23
|
+
- ActiveRecord >= 7.1, < 9.0
|
|
24
|
+
- PostgreSQL with the `btree_gist` extension available
|
|
14
25
|
|
|
15
26
|
## Installation
|
|
16
27
|
|
|
@@ -46,7 +57,7 @@ In your migrations, you can use the `add_time_range_uniqueness` method to add a
|
|
|
46
57
|
### Example
|
|
47
58
|
|
|
48
59
|
```ruby
|
|
49
|
-
class AddEventTimeRangeUniqueness < ActiveRecord::Migration[
|
|
60
|
+
class AddEventTimeRangeUniqueness < ActiveRecord::Migration[7.1]
|
|
50
61
|
def change
|
|
51
62
|
add_time_range_uniqueness :events,
|
|
52
63
|
with: :event_time_range,
|
|
@@ -60,7 +71,7 @@ This example ensures that the `event_time_range` column in the `events` table is
|
|
|
60
71
|
|
|
61
72
|
### Model Additions
|
|
62
73
|
|
|
63
|
-
The gem also provides model-level validation to ensure time ranges do not overlap.
|
|
74
|
+
The gem also provides model-level validation to ensure time ranges do not overlap. The `validates_time_range_uniqueness` class method is available on all ActiveRecord models, so you can declare it directly in your model like this:
|
|
64
75
|
|
|
65
76
|
#### Options:
|
|
66
77
|
- `with`: **(Required)** The name of the time range column to validate.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: time_range_uniqueness
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- j-boers-13
|
|
@@ -71,7 +71,7 @@ licenses:
|
|
|
71
71
|
metadata:
|
|
72
72
|
source_code_uri: https://github.com/j-boers-13/time_range_uniqueness
|
|
73
73
|
homepage_uri: https://github.com/j-boers-13/time_range_uniqueness
|
|
74
|
-
changelog_uri: https://github.com/j-boers-13/time_range_uniqueness/CHANGELOG.md
|
|
74
|
+
changelog_uri: https://github.com/j-boers-13/time_range_uniqueness/blob/main/CHANGELOG.md
|
|
75
75
|
rubygems_mfa_required: 'true'
|
|
76
76
|
rdoc_options: []
|
|
77
77
|
require_paths:
|