activerecord-beagle-turso 0.1.2 → 0.1.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: bca0371351d06b733b45c110457870093af9b82db4df224d51940d2da3f67289
4
- data.tar.gz: b80598ef59803b2380f55838cb05feb50c860c6df6e4628a5e646e1a98e19d74
3
+ metadata.gz: 7b4bdeec9d75fe6297e7f42aba4ab966b31407731a5992de2af9a214483c53c7
4
+ data.tar.gz: bc8dcf3930ec2eb8104712b5f910b38118cd75ae0840d0d98bcb9a145d958f21
5
5
  SHA512:
6
- metadata.gz: '068d1f9559e9aa7996f6f3c834b087ceb294db2869c76501201a5ace60d64dc6706e6f46cd58c43026f2b423c72d83ed013172c049ce284bebbcc4ea805dc821'
7
- data.tar.gz: 5c119de77b070ebd9270bb373cfcbc562ec0d3dd716d3b079622ecfdb8dc1c7303dbdd11b60f922672a8fdfd8f428d64c7c967098a73bd81d159545a0a162bfe
6
+ metadata.gz: 7b31dbac6656267e980d1fc85b7c8ce805ea538564750b9f537b957ba1d6443cddee350d375730a64a83c8444b35fe76df90952fd76f11661494f07ae0ea5683
7
+ data.tar.gz: 0e77f74a3dca74225fd169e4556b6b948ae42c2702b555e19c3e034cf1301da3267428b04198eefad73da422037de6574d61ee46ca77d06541a026eccb5ff60e
@@ -126,7 +126,22 @@ module ActiveRecord
126
126
  # foreign_key_check) falls through to the real driver result instead
127
127
  # of a synthesized one -- failing loudly on a genuine future gap
128
128
  # rather than silently lying.
129
- BARE_PRAGMA_READ_REGEX = /\A\s*PRAGMA\s+(defer_foreign_keys|read_uncommitted)\s*\z/i
129
+ #
130
+ # The SQL-comment allowances on both ends are load-bearing, not
131
+ # cosmetic: with `config.active_record.query_log_tags_enabled = true`
132
+ # (the Rails app-generator default for development since 7.0) every
133
+ # statement arrives tagged -- `PRAGMA defer_foreign_keys
134
+ # /*application='MyApp'*/`. An `\z`-anchored match misses that, the
135
+ # synthesized default never fires, and the very crash this constant
136
+ # exists to prevent comes back: `add_foreign_key` (and every other
137
+ # alter_table schema change) dies with "query failed: incomplete
138
+ # input" while loading db/schema.rb. Tags can be prepended as well as
139
+ # appended (query_log_tags_format / prepend_comment), so allow both.
140
+ SQL_COMMENTS = %r{(?:\s*/\*.*?\*/)*}m
141
+ private_constant :SQL_COMMENTS
142
+
143
+ BARE_PRAGMA_READ_REGEX =
144
+ /\A#{SQL_COMMENTS}\s*PRAGMA\s+(defer_foreign_keys|read_uncommitted)\s*#{SQL_COMMENTS}\s*\z/im
130
145
  private_constant :BARE_PRAGMA_READ_REGEX
131
146
 
132
147
  # --- execution surface used by BeagleTursoAdapter#perform_query ---
@@ -191,6 +206,23 @@ module ActiveRecord
191
206
  end
192
207
 
193
208
  private
209
+ # Every table-listing question Rails asks (`tables`, `views`,
210
+ # `data_sources`, `table_exists?`, and through them the schema cache and
211
+ # the schema dumper) is built from this one string in
212
+ # SQLite3::SchemaStatements.
213
+ #
214
+ # beagle_turso's engine keeps a `__turso_internal_seq___turso_internal_
215
+ # autoincrement_<table>` bookkeeping table for each AUTOINCREMENT table.
216
+ # They are engine internals of exactly the kind Rails already excludes
217
+ # by name (`sqlite_sequence`, `sqlite_schema`), but Rails cannot know
218
+ # about them -- so without this filter `db:schema:dump` emits one
219
+ # `create_table "__turso_internal_seq_..."` block per table into
220
+ # db/schema.rb, and the next `db:schema:load` tries to create them for
221
+ # real.
222
+ def data_source_sql(name = nil, type: nil)
223
+ "#{super} AND name NOT LIKE '\\_\\_turso\\_internal\\_%' ESCAPE '\\'"
224
+ end
225
+
194
226
  # The single seam. AbstractAdapter#raw_execute funnels every statement
195
227
  # here and expects an ActiveRecord::Result back, with the notification
196
228
  # payload's affected_rows/row_count filled in. cast_result (inherited)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module BeagleTurso
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-beagle-turso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - BeagleSoftwareUK
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-08 00:00:00.000000000 Z
11
+ date: 2026-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord