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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b474095677d024d7aae488865411803476f0c5040d75fba89b063f0e9679a3d9
4
- data.tar.gz: 18a4bbf0d5744c8e980a50ee4b6ee6a75133f299a96eabd458ca1bf40554bb78
3
+ metadata.gz: 5005f9218456b8961e7cb6c61ea685d10cc327765f9509a49a766b3389634132
4
+ data.tar.gz: 878e67e40ece7e731e9aae8f412f3e0733f43e56202e83d77212d44c032ef191
5
5
  SHA512:
6
- metadata.gz: a719c2d1f1de9e98ac56a45ab3956ce5b216dd1987e510688af3d71cfe131f98463cbab9525ca96ef2cc34a4457d3475b65016f8595a9f4f3c9b5f621a503247
7
- data.tar.gz: b0f0d139f3da9c4eb8bea8805cbefeff6c11dae8dcf47853b8a157b402e4c10103bbf8b94a84a8ef1d80c7fe07a63e2effa042bff21d6ac3591b7340ff6c1b55
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.0 - 2026-09-07
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
- # RubyDB ActiveRecord adapter
2
-
3
- The `rubydb-activerecord` gem connects Rails applications to RubyDB through
4
- ActiveRecord. It supports embedded RubyDB engines and network connections.
5
-
6
- For an executable Rails 7.2 example, see
7
- [`examples/rails_app`](../../examples/rails_app). The example includes a
8
- database configuration, migration, model/controller, browser form, and a
9
- smoke test that exercises the adapter against a real RubyDB engine.
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 { |column| row[column] || row[column.to_sym] }
780
- end
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
- spec.required_ruby_version = ">= 3.2.0"
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = spec.homepage
17
-
18
- spec.files = Dir.glob("lib/**/*.rb") + %w[README.md]
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
@@ -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.0"
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 = 0
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldane Hutchinson