activerecord-turso 0.3.2 → 0.3.3

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: 8dc77c288fa28d1c9872459245f9afe593a510dac77d5e0630bdb58d7bab4b90
4
- data.tar.gz: 192ddeb9179b451e2844ce533f1bbaf7a96bae2c493a1b0a322398401dae838a
3
+ metadata.gz: a01719b3af125da831484f92746047dcc6b93870d38cc328f47dacd356b9bc53
4
+ data.tar.gz: 86fad027bd12ace8b43f359c2118c9c04ade3f0b5408d516a1e3ec165963a6e2
5
5
  SHA512:
6
- metadata.gz: 502dce7acddd392a64255e2e59d3fa7290196218968456dc4a4032bdfe83fde510f31625ae260bb9f4d979fc5af1626ac3dfc4484608b32dd223cb37d75d9dfc
7
- data.tar.gz: 6f8570e0a2e17733238babaaf41a17dba6d5cf2e8ca1b983d883dd4a3b0a0fc7373975c9fb21d4bac0e273de3feaa1377f263e68f5123e703761c73067b840ce
6
+ metadata.gz: 5bb60d2fd6f7068774f587d06614d4023b0a047ac02e97deb98d393c94686174a7c04b9a4122c80e7e1971fce0cf272cf6b6f1dd49d9db1936ed8f36d1dff181
7
+ data.tar.gz: bf562f2e7c986ed051de4e800800e62e19624d146ee88d76a18db4727bde00540f1825962da035ad8caf7dfeee3c4467f055282f940418e521fbbb77b9efb5c8
data/README.md CHANGED
@@ -141,7 +141,7 @@ match = ActiveRecord::Base.connection.fts_match(:posts, [:title, :body], "databa
141
141
  Post.where(match)
142
142
 
143
143
  score = ActiveRecord::Base.connection.fts_score(:posts, [:title, :body], "database")
144
- Post.select(:id, :title, score.as("rank")).where(match).order("rank ASC")
144
+ Post.select(:id, :title, score.as("rank")).where(match).order("rank DESC")
145
145
  ```
146
146
 
147
147
  Note: `fts5` virtual tables are not supported. Use `USING fts` indexes instead. This requires the `index_method` experimental feature:
@@ -43,8 +43,12 @@ module ActiveRecord
43
43
  def reconnect!(**)
44
44
  @lock.synchronize do
45
45
  disconnect!
46
- @raw_connection = self.class.new_client(@config)
47
- configure_connection
46
+ begin
47
+ @raw_connection = self.class.new_client(@config)
48
+ configure_connection
49
+ rescue => original_exception
50
+ raise translate_exception_class(original_exception, nil, nil)
51
+ end
48
52
  end
49
53
  end
50
54
 
@@ -9,13 +9,13 @@ module ActiveRecord
9
9
  when ::Turso::ConstraintException
10
10
  translate_constraint_error(message, sql, binds)
11
11
  when ::Turso::NotADatabaseException
12
- ActiveRecord::NoDatabaseError.new(message, sql: sql, binds: binds)
12
+ ActiveRecord::NoDatabaseError.new(message, connection_pool: pool)
13
13
  when ::Turso::BusySnapshotException
14
14
  ActiveRecord::SerializationFailure.new(message, sql: sql, binds: binds)
15
15
  when ::Turso::BusyException
16
16
  ActiveRecordTurso::BusyError.new(message, sql: sql, binds: binds)
17
17
  when ::Turso::ReadonlyException
18
- ActiveRecord::ReadOnlyRecord.new(message, sql: sql, binds: binds)
18
+ ActiveRecord::ReadOnlyRecord.new(message)
19
19
  when ::Turso::IoException, ::Turso::CorruptException
20
20
  ActiveRecord::StatementInvalid.new(message, sql: sql, binds: binds)
21
21
  when ::Turso::DatabaseFullException
@@ -26,6 +26,7 @@ module ActiveRecord
26
26
  FileUtils.rm_f(path)
27
27
  FileUtils.rm_f("#{path}-wal")
28
28
  FileUtils.rm_f("#{path}-shm")
29
+ FileUtils.rm_f(mvcc_log_path(path))
29
30
  end
30
31
 
31
32
  def purge
@@ -107,6 +108,12 @@ module ActiveRecord
107
108
  @configuration
108
109
  end
109
110
 
111
+ # Turso stores the MVCC logical log beside the database as
112
+ # `<database>.db-log` (Rust's `Path::with_extension`).
113
+ def mvcc_log_path(path)
114
+ path.sub(/\.[^.\/]+\z/, "") + ".db-log"
115
+ end
116
+
110
117
  def connection
111
118
  ActiveRecord::Base.connection
112
119
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordTurso
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-turso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben D'Angelo