rubydb 0.1.0 → 0.1.1
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 +11 -4
- data/adapters/activerecord/README.md +133 -9
- data/adapters/activerecord/lib/active_record/connection_adapters/rubydb_adapter.rb +9 -3
- data/adapters/activerecord/rubydb-activerecord.gemspec +11 -6
- data/adapters/activerecord/spec/rubydb_adapter_integration_spec.rb +13 -3
- data/lib/rubydb/version.rb +3 -3
- 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: 5005f9218456b8961e7cb6c61ea685d10cc327765f9509a49a766b3389634132
|
|
4
|
+
data.tar.gz: 878e67e40ece7e731e9aae8f412f3e0733f43e56202e83d77212d44c032ef191
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c81b88aa18802979d5320534cf7ee7270e84a6c48b2a9528b8bec135439f5c84c3a0b45a7e3012d6a3fbdbdb6b226f4ed29dc9a3edbe86333b2e0eb633214b5c
|
|
7
|
+
data.tar.gz: 1fe32bd686090053c717631b97a6e996094c5284c77c452ede991d18aefc248616d905c44f12a2dae725bb19aa7f603e235ba8c9fe6a97ca121cef38f24d3237
|
data/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to RubyDB are documented here. Versions follow
|
|
4
4
|
[Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
-
## Unreleased
|
|
6
|
+
## Unreleased
|
|
7
7
|
|
|
8
8
|
- Added full developer, troubleshooting, debugging, production operations,
|
|
9
9
|
Rails compatibility, and SQL compatibility guides with repository maps,
|
|
@@ -21,9 +21,16 @@ All notable changes to RubyDB are documented here. Versions follow
|
|
|
21
21
|
- Added a full CLI guide and cheat sheet covering lifecycle, server operation,
|
|
22
22
|
shell, migrations, backup/restore, snapshots, branches, inspection, doctor,
|
|
23
23
|
vacuum, maintenance, and release workflows.
|
|
24
|
-
- Clarified the tested common SQLite-style profile and production limits.
|
|
25
|
-
|
|
26
|
-
## 0.1.
|
|
24
|
+
- Clarified the tested common SQLite-style profile and production limits.
|
|
25
|
+
|
|
26
|
+
## 0.1.1 - 2026-09-09
|
|
27
|
+
|
|
28
|
+
- Published the Rails connection configuration fixes for embedded database
|
|
29
|
+
paths and `rubydb://`/`rubydbs://` connection URLs.
|
|
30
|
+
- Kept the patch release compatible with the RubyDB 0.1.x adapter dependency
|
|
31
|
+
range.
|
|
32
|
+
|
|
33
|
+
## 0.1.0 - 2026-09-07
|
|
27
34
|
|
|
28
35
|
- Initial public release candidate.
|
|
29
36
|
- Includes the embedded engine, ActiveRecord adapter, backup/recovery, WAL,
|
|
@@ -1,9 +1,133 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
# rubydb-activerecord
|
|
2
|
+
|
|
3
|
+
`rubydb-activerecord` is the ActiveRecord adapter for [RubyDB](https://github.com/aldanedev-create/rubydb). It lets Rails applications use RubyDB through the normal model, relation, transaction, migration, schema, and connection-pool APIs.
|
|
4
|
+
|
|
5
|
+
This gem is an adapter to RubyDB's SQL engine. It is not a PostgreSQL, MySQL, or SQLite wire-protocol compatibility layer, and it does not make arbitrary dialect-specific SQL portable. Validate your application's queries and migrations against the exact Ruby, Rails, RubyDB, operating-system, and deployment versions you will run.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Ruby 3.3 or newer
|
|
10
|
+
- RubyDB 0.1.x
|
|
11
|
+
- ActiveRecord 7.1, 7.2, or 8.0 (the dependency range is `>= 7.1`, `< 8.1`)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Add both gems to the Rails application's `Gemfile`:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
gem "rubydb"
|
|
19
|
+
gem "rubydb-activerecord"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then run:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
bundle install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The adapter registers itself under the `rubydb` adapter name when it is
|
|
29
|
+
required by Bundler. For a manually loaded application, require it explicitly:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
require "rubydb"
|
|
33
|
+
require "active_record/connection_adapters/rubydb_adapter"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Development: embedded database
|
|
37
|
+
|
|
38
|
+
Embedded mode is convenient for local development and a controlled
|
|
39
|
+
single-process application. The process owns the database file:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
# config/database.yml
|
|
43
|
+
development:
|
|
44
|
+
adapter: rubydb
|
|
45
|
+
embedded: true
|
|
46
|
+
database: <%= Rails.root.join("tmp/development.rdb") %>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Run migrations normally:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
bin/rails db:migrate
|
|
53
|
+
bin/rails console
|
|
54
|
+
bin/rails server
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Do not open the same embedded path from multiple independent Rails processes.
|
|
58
|
+
For multiple web workers, job workers, or hosts, use a managed RubyDB server.
|
|
59
|
+
|
|
60
|
+
## Production: managed server
|
|
61
|
+
|
|
62
|
+
Use a network connection when the application has more than one process or
|
|
63
|
+
when the database must be operated independently from the application. Keep
|
|
64
|
+
credentials in the platform secret manager and map them into `database.yml`:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
# config/database.yml
|
|
68
|
+
production:
|
|
69
|
+
adapter: rubydb
|
|
70
|
+
embedded: false
|
|
71
|
+
url: <%= ENV.fetch("RUBYDB_URL") %>
|
|
72
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS", "5") %>
|
|
73
|
+
timeout: <%= ENV.fetch("RUBYDB_TIMEOUT", "30") %>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use `rubydb://` for a plain private-network connection or `rubydbs://` for TLS:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
rubydbs://app_user:URL_ENCODED_PASSWORD@db.internal.example:7432/app?verify_peer=true&ca_file=%2Fetc%2Frubydb%2Ftls%2Fca.crt
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The server must be deployed separately with persistent storage,
|
|
83
|
+
authentication, TLS, backups, monitoring, resource limits, and a tested
|
|
84
|
+
restore procedure. Size its connection limit for the total Rails pool across
|
|
85
|
+
all application processes, with headroom for administration and replication.
|
|
86
|
+
See the repository's [Rails database configuration](../../docs/rails/database-yml.md)
|
|
87
|
+
and [production guidance](../../docs/rails/production.md).
|
|
88
|
+
|
|
89
|
+
## Adapter surface
|
|
90
|
+
|
|
91
|
+
The release test suite exercises:
|
|
92
|
+
|
|
93
|
+
- ActiveRecord CRUD, binds, quoted identifiers, type casting, and false/zero values
|
|
94
|
+
- transactions and savepoints
|
|
95
|
+
- `joins`, qualified filters, ordering, eager loading, and nested associations
|
|
96
|
+
- table/column/index/foreign-key introspection
|
|
97
|
+
- Rails migrations, defaults, indexes, schema dumps, and populated-table changes
|
|
98
|
+
- embedded and network connection setup paths
|
|
99
|
+
|
|
100
|
+
RubyDB currently has documented SQL and schema boundaries. Features outside
|
|
101
|
+
the tested surface—such as dialect-specific extensions, generated columns,
|
|
102
|
+
complex table rebuilds, or application-specific Arel—need explicit tests
|
|
103
|
+
before deployment.
|
|
104
|
+
|
|
105
|
+
## Validation
|
|
106
|
+
|
|
107
|
+
Run the adapter's integration suite from this directory:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
bundle install
|
|
111
|
+
bundle exec rspec spec
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Run the repository's Rails-focused checks from the repository root:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
bundle exec rspec spec/rails_adapter_live_engine_spec.rb spec/rails_adapter_schema_dump_spec.rb spec/rails_schema_statements_spec.rb
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Before a production release, run a real migration and smoke query through the
|
|
121
|
+
same server URL, TLS settings, pool size, and secret-management path used by
|
|
122
|
+
the deployment. Keep a verified backup before migrations and rehearse restore
|
|
123
|
+
and rollback on a representative copy.
|
|
124
|
+
|
|
125
|
+
## Support and release policy
|
|
126
|
+
|
|
127
|
+
The adapter version is coupled to the RubyDB 0.1.x release line. Pin both gems
|
|
128
|
+
in the application lockfile, upgrade them together, and run the adapter suite
|
|
129
|
+
before upgrading Rails. Report reproducible adapter or engine issues at the
|
|
130
|
+
project's [issue tracker](https://github.com/aldanedev-create/rubydb/issues)
|
|
131
|
+
with Ruby/Rails/RubyDB versions, the SQL or migration involved, and a redacted
|
|
132
|
+
configuration summary. Never include passwords, connection URLs, database
|
|
133
|
+
files, or private keys in reports.
|
|
@@ -775,9 +775,15 @@ module ActiveRecord
|
|
|
775
775
|
column.is_a?(Hash) ? (column[:name] || column["name"] || column) : column
|
|
776
776
|
end.map(&:to_s)
|
|
777
777
|
end
|
|
778
|
-
values = rows.map do |row|
|
|
779
|
-
columns.map
|
|
780
|
-
|
|
778
|
+
values = rows.map do |row|
|
|
779
|
+
columns.map do |column|
|
|
780
|
+
if row.respond_to?(:key?) && row.key?(column)
|
|
781
|
+
row[column]
|
|
782
|
+
elsif row.respond_to?(:key?) && row.key?(column.to_sym)
|
|
783
|
+
row[column.to_sym]
|
|
784
|
+
end
|
|
785
|
+
end
|
|
786
|
+
end
|
|
781
787
|
ActiveRecord::Result.new(columns, values)
|
|
782
788
|
end
|
|
783
789
|
|
|
@@ -10,12 +10,17 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.description = "ActiveRecord adapter for the RubyDB database"
|
|
11
11
|
spec.homepage = "https://github.com/aldanedev-create/rubydb"
|
|
12
12
|
spec.license = "MIT"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
spec.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
spec.
|
|
13
|
+
# rubydb itself requires Ruby 3.3 or newer. Keep the adapter's runtime
|
|
14
|
+
# contract aligned so Bundler cannot select an unsupported combination.
|
|
15
|
+
spec.required_ruby_version = ">= 3.3.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "#{spec.homepage}/tree/main/adapters/activerecord"
|
|
19
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/aldanedev-create/rubydb/issues"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/aldanedev-create/rubydb/blob/main/CHANGELOG.md"
|
|
21
|
+
spec.metadata["documentation_uri"] = "https://github.com/aldanedev-create/rubydb/tree/main/docs"
|
|
22
|
+
|
|
23
|
+
spec.files = Dir.glob("lib/**/*.rb") + %w[README.md rubydb-activerecord.gemspec]
|
|
19
24
|
spec.require_paths = ["lib"]
|
|
20
25
|
|
|
21
26
|
spec.add_dependency "activerecord", ">= 7.1", "< 8.1"
|
|
@@ -31,15 +31,25 @@ RSpec.describe ActiveRecord::ConnectionAdapters::RubyDBAdapter do
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
it "creates and finds an ActiveRecord model through the embedded engine" do
|
|
34
|
+
it "creates and finds an ActiveRecord model through the embedded engine" do
|
|
35
35
|
connection = ActiveRecord::Base.connection
|
|
36
36
|
connection.execute("CREATE TABLE accounts (id INTEGER PRIMARY KEY, email VARCHAR(255) NOT NULL, active BOOLEAN NOT NULL)")
|
|
37
37
|
|
|
38
38
|
created = model.create!(id: 1, email: "ada@example.test", active: true)
|
|
39
39
|
loaded = model.find(created.id)
|
|
40
40
|
|
|
41
|
-
expect(loaded.attributes).to include("id" => 1, "email" => "ada@example.test", "active" => true)
|
|
42
|
-
end
|
|
41
|
+
expect(loaded.attributes).to include("id" => 1, "email" => "ada@example.test", "active" => true)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "preserves false and zero values in ActiveRecord results" do
|
|
45
|
+
connection = ActiveRecord::Base.connection
|
|
46
|
+
connection.execute("CREATE TABLE flags (id INTEGER PRIMARY KEY, enabled BOOLEAN NOT NULL, attempts INTEGER NOT NULL)")
|
|
47
|
+
connection.execute("INSERT INTO flags (id, enabled, attempts) VALUES (1, FALSE, 0)")
|
|
48
|
+
|
|
49
|
+
result = connection.exec_query("SELECT enabled, attempts FROM flags WHERE id = 1")
|
|
50
|
+
|
|
51
|
+
expect(result.first).to include("enabled" => false, "attempts" => 0)
|
|
52
|
+
end
|
|
43
53
|
|
|
44
54
|
it "runs a Rails migration that creates a table, adds a column, and adds an index" do
|
|
45
55
|
migration = Class.new(ActiveRecord::Migration[migration_version]) do
|
data/lib/rubydb/version.rb
CHANGED
|
@@ -11,13 +11,13 @@ module RubyDB
|
|
|
11
11
|
# - MAJOR: Incompatible API changes
|
|
12
12
|
# - MINOR: Backwards-compatible new functionality
|
|
13
13
|
# - PATCH: Backwards-compatible bug fixes
|
|
14
|
-
VERSION = "0.1.
|
|
14
|
+
VERSION = "0.1.1"
|
|
15
15
|
|
|
16
16
|
# Version components for easy access
|
|
17
17
|
module Version
|
|
18
18
|
MAJOR = 0
|
|
19
19
|
MINOR = 1
|
|
20
|
-
PATCH =
|
|
20
|
+
PATCH = 1
|
|
21
21
|
PRE = nil # e.g., "alpha", "beta", "rc1"
|
|
22
22
|
|
|
23
23
|
def self.to_s
|
|
@@ -30,4 +30,4 @@ module RubyDB
|
|
|
30
30
|
version
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
|
-
end
|
|
33
|
+
end
|