bridgetown_sequel 1.1.1 → 1.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +51 -11
- data/lib/bridgetown_sequel/version.rb +1 -1
- data/lib/tasks/sequel_database.rake +3 -1
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1bcfa80851500486fb60406eb116c4e6213da89a303f4069c9decf6f10f4654
|
|
4
|
+
data.tar.gz: d375d3ee2e3c8624cf439492823aaf48ca1fd7b06083214d09ddb8569f632167
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0369205b0e0c7eb789082e7c2ba855e50149d25aa585edcf6d284472895c20b85c7ff2bd4a75d541be3f9b33aae88a6bb41390f312a00be44cfa3ddf52d984a4'
|
|
7
|
+
data.tar.gz: 2a99174d59db43c08cfd0f5b1864b2e5362a1fb4e06acf1faebcc5e2e2e1de46442b6c9a2fc0908e795a41811072b53114998101ee8b21a9b90873bc25c98cd2
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.2] - 2026-08-03
|
|
11
|
+
|
|
12
|
+
- Fix `say_status` not living inside of automation block
|
|
13
|
+
|
|
10
14
|
## [1.1.1] - 2024-04-03
|
|
11
15
|
|
|
12
16
|
- Fix lambda error in initializer
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -4,6 +4,9 @@ A Bridgetown plugin to make it easy to integrate and use [Sequel](https://sequel
|
|
|
4
4
|
|
|
5
5
|
It's been tested only with PostgreSQL, but it should support any of the databases supported by Sequel.
|
|
6
6
|
|
|
7
|
+
> [!TIP]
|
|
8
|
+
> If you're like me and you greatly prefer YARD's UI to RDoc, check out [Sequel on Gemdocs](https://gemdocs.org/gems/sequel/5.97.0/).
|
|
9
|
+
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
9
12
|
Run these commands to add this plugin along with the database adapter of your choice to your site's Gemfile:
|
|
@@ -23,6 +26,8 @@ except :sequel_tasks do
|
|
|
23
26
|
end
|
|
24
27
|
```
|
|
25
28
|
|
|
29
|
+
(For a Unix socket, your hostname in the connection string should be something like `%2Fvar%2Frun%2Fpostgresql` instead of `localhost`)
|
|
30
|
+
|
|
26
31
|
You'll also want to add this plugin's Rake tasks to your `Rakefile`:
|
|
27
32
|
|
|
28
33
|
```rb
|
|
@@ -36,6 +41,33 @@ BridgetownSequel.load_tasks
|
|
|
36
41
|
|
|
37
42
|
Finally, you'll want to create a `models` folder at the top-level of your site repo, as well as a `migrations` folder.
|
|
38
43
|
|
|
44
|
+
### Resolving PostgreSQL fork error on macOS
|
|
45
|
+
|
|
46
|
+
There's a bug on macOS which will crash Bridgetown & Sequel unless you disable PostgreSQL's GSSAPI support (not needed for local development). You'll need to update your configuration as follows:
|
|
47
|
+
|
|
48
|
+
```rb
|
|
49
|
+
init :bridgetown_sequel do
|
|
50
|
+
connection_options do
|
|
51
|
+
if RUBY_PLATFORM.include?("darwin")
|
|
52
|
+
driver_options { gssencmode "disable" }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Ensuring Puma forks successfully in production
|
|
59
|
+
|
|
60
|
+
In production, Bridgetown's Puma server configuration is set to "clustered mode" which forks the server process several times. This will result in Sequel connection errors if you don't shut down the database connection first. Update your `config/puma.rb` file so the production config looks like this:
|
|
61
|
+
|
|
62
|
+
```rb
|
|
63
|
+
if ENV["BRIDGETOWN_ENV"] == "production"
|
|
64
|
+
workers ENV.fetch("BRIDGETOWN_CONCURRENCY") { 4 }
|
|
65
|
+
before_fork do
|
|
66
|
+
Bridgetown.db.disconnect if defined?(Bridgetown) && Bridgetown.respond_to?(:db)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
```
|
|
70
|
+
|
|
39
71
|
## Usage
|
|
40
72
|
|
|
41
73
|
To add your first database table & model, first you'll want to add a model file to your new `models` folder. It can look as simple as this:
|
|
@@ -48,10 +80,16 @@ class Project < Sequel::Model
|
|
|
48
80
|
end
|
|
49
81
|
```
|
|
50
82
|
|
|
83
|
+
Let's set up the database now. Run this command (you only need to do this once for your repo):
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
bin/bridgetown db:setup
|
|
87
|
+
```
|
|
88
|
+
|
|
51
89
|
Next, you'll want to create a migration. Run the following command:
|
|
52
90
|
|
|
53
91
|
```shell
|
|
54
|
-
bin/bridgetown db
|
|
92
|
+
bin/bridgetown db:migrations:new filename=create_projects
|
|
55
93
|
```
|
|
56
94
|
|
|
57
95
|
And modify the new `migrations/001_create_projects.rb` file to look something like this:
|
|
@@ -72,13 +110,7 @@ Sequel.migration do
|
|
|
72
110
|
end
|
|
73
111
|
```
|
|
74
112
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```shell
|
|
78
|
-
bin/bridgetown db:setup
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Then run migrations:
|
|
113
|
+
Finally, run migrations:
|
|
82
114
|
|
|
83
115
|
```shell
|
|
84
116
|
bin/bridgetown db:migrate
|
|
@@ -96,7 +128,8 @@ Now let's test your model. Run `bin/bridgetown console` (or `bin/bt c` for short
|
|
|
96
128
|
|
|
97
129
|
You should now see that you can save and load project records in your database.
|
|
98
130
|
|
|
99
|
-
|
|
131
|
+
> [!NOTE]
|
|
132
|
+
> If you ever need to drop your database and start over, run `bin/bridgetown db:drop`.
|
|
100
133
|
|
|
101
134
|
### Optional Configuration
|
|
102
135
|
|
|
@@ -130,7 +163,14 @@ Raw SQL statements won't be logged out-of-the-box, but you can attach Bridgetown
|
|
|
130
163
|
Bridgetown.db.loggers << Bridgetown.logger
|
|
131
164
|
```
|
|
132
165
|
|
|
133
|
-
|
|
166
|
+
----
|
|
167
|
+
|
|
168
|
+
> [!TIP]
|
|
169
|
+
> For a quick reference on what you can do with the Sequel DSL, check out this [handy cheat sheet](https://devhints.io/sequel).
|
|
170
|
+
>
|
|
171
|
+
> Also read [Sequel on Gemdocs](https://gemdocs.org/gems/sequel/latest), and check out all the [plugins & database extensions](http://sequel.jeremyevans.net/plugins.html#extensions-database-sequel) you can add to Sequel models.
|
|
172
|
+
|
|
173
|
+
----
|
|
134
174
|
|
|
135
175
|
## Contributing
|
|
136
176
|
|
|
@@ -143,5 +183,5 @@ For a quick reference on what you can do with the Sequel DSL, check out this [ha
|
|
|
143
183
|
|
|
144
184
|
## Testing
|
|
145
185
|
|
|
146
|
-
* Run `
|
|
186
|
+
* Run `script/test` to run the test suite.
|
|
147
187
|
* Or run `script/cibuild` to validate with Rubocop and Minitest together.
|
|
@@ -114,6 +114,8 @@ namespace :db do
|
|
|
114
114
|
models.each { say_status :database, "Annotated #{_1}" }
|
|
115
115
|
end
|
|
116
116
|
rescue Sequel::DatabaseError
|
|
117
|
-
|
|
117
|
+
automation do
|
|
118
|
+
say_status :database, "Annotations failed. Perhaps you performed a rollback?", :red
|
|
119
|
+
end
|
|
118
120
|
end
|
|
119
121
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown_sequel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bridgetown Team
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-08-03 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bridgetown
|
|
@@ -94,7 +93,6 @@ dependencies:
|
|
|
94
93
|
- - "~>"
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
95
|
version: '0.3'
|
|
97
|
-
description:
|
|
98
96
|
email: maintainers@bridgetownrb.com
|
|
99
97
|
executables: []
|
|
100
98
|
extensions: []
|
|
@@ -116,7 +114,6 @@ homepage: https://github.com/bridgetownrb/bridgetown_sequel
|
|
|
116
114
|
licenses:
|
|
117
115
|
- MIT
|
|
118
116
|
metadata: {}
|
|
119
|
-
post_install_message:
|
|
120
117
|
rdoc_options: []
|
|
121
118
|
require_paths:
|
|
122
119
|
- lib
|
|
@@ -131,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
128
|
- !ruby/object:Gem::Version
|
|
132
129
|
version: '0'
|
|
133
130
|
requirements: []
|
|
134
|
-
rubygems_version: 3.
|
|
135
|
-
signing_key:
|
|
131
|
+
rubygems_version: 3.6.2
|
|
136
132
|
specification_version: 4
|
|
137
133
|
summary: Bridgetown plugin for integrating the Sequel database gem
|
|
138
134
|
test_files: []
|