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 +4 -4
- data/README.md +1 -1
- data/lib/active_record/connection_adapters/turso_adapter/connection_management.rb +6 -2
- data/lib/active_record/connection_adapters/turso_adapter/error_translation.rb +2 -2
- data/lib/active_record/tasks/turso_database_tasks.rb +7 -0
- data/lib/activerecord-turso/version.rb +1 -1
- 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: a01719b3af125da831484f92746047dcc6b93870d38cc328f47dacd356b9bc53
|
|
4
|
+
data.tar.gz: 86fad027bd12ace8b43f359c2118c9c04ade3f0b5408d516a1e3ec165963a6e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
-
|
|
47
|
-
|
|
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,
|
|
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
|
|
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
|