activerecord-beagle-turso 0.1.5 → 0.1.6

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: 96e5e44a6be08be7733d3f7ea9590e6577826c43d8ecffe178f6bb6314d3396c
4
- data.tar.gz: 66627c1ff6245cb9f44180c6152020248d49f58722359c7070ce883a9cbe4ed2
3
+ metadata.gz: 0a1a95bf62c876f996098db6a065aa9157af882b13d5038c7a86226ea6514b8b
4
+ data.tar.gz: 36d1eb3bdaf31d214ca80a1ab3754323cec795172bf00e2bcfd78d6812a7b3d7
5
5
  SHA512:
6
- metadata.gz: cc94306cead989dba2cf18789880c63cc4eb27b973812bec9f807fbbdf40b81baef90edcc512d099a90c2955427ed56582c51c0dd1d7fb6fc1439e973dfbbd5f
7
- data.tar.gz: d15c112f354343e61bda83c8f146603ae0aa1c6da19381e158eb01ce84ee487f82e67e775d416328196d5c2cf7a4f25872954219a63f75181535318681d806a3
6
+ metadata.gz: ab8346581f6054cec006ab218b12e03db82b4dde79f5afe3093fee8ccfc8e3116f5dc82b4152cccaac0415c449a19a4fbe4343cf6bfc34c11992eb3a7ee6b925
7
+ data.tar.gz: 83ba09effe58a3c3598034db2982ab7f6a0037da1b4beeefea01db6b57c1ffc94de39b8ebf6b9bd09af87da48d94a2cbffdbe2445e911270c7e293f416f8eade
data/README.md CHANGED
@@ -67,6 +67,8 @@ An optional `bootstrap_if_empty:` (default `true`) controls whether a brand
67
67
  new/empty local file is populated from the remote on first open — see
68
68
  `Beagle::Turso::Database.open`.
69
69
 
70
+ The sync engine's own tables (`turso_cdc`, `turso_cdc_version`, `turso_sync_last_change_id`) are hidden from `connection.tables`/`data_sources` and therefore from schema dumps and table-truncating tooling.
71
+
70
72
  ### Durability note: writes commit on-sync, not synchronously
71
73
 
72
74
  Writes go to the **local** file immediately, as part of the normal
@@ -219,8 +219,21 @@ module ActiveRecord
219
219
  # `create_table "__turso_internal_seq_..."` block per table into
220
220
  # db/schema.rb, and the next `db:schema:load` tries to create them for
221
221
  # real.
222
+ #
223
+ # On a synced replica the sync engine also keeps its change log in
224
+ # three tables (`turso_cdc`, `turso_cdc_version`,
225
+ # `turso_sync_last_change_id`). They are matched by EXACT name so a user
226
+ # table such as `turso_sync_log` stays visible. Left unfiltered,
227
+ # `db:schema:dump` would dump them and `db:truncate_all`, fixtures or
228
+ # DatabaseCleaner truncation would wipe the change log (losing unpushed
229
+ # sync data).
230
+ SYNC_ENGINE_TABLES = %w[turso_cdc turso_cdc_version turso_sync_last_change_id].freeze
231
+ private_constant :SYNC_ENGINE_TABLES
232
+
222
233
  def data_source_sql(name = nil, type: nil)
223
- "#{super} AND name NOT LIKE '\\_\\_turso\\_internal\\_%' ESCAPE '\\'"
234
+ hidden = SYNC_ENGINE_TABLES.map { |t| quote(t) }.join(", ")
235
+ "#{super} AND name NOT LIKE '\\_\\_turso\\_internal\\_%' ESCAPE '\\'" \
236
+ " AND name NOT IN (#{hidden})"
224
237
  end
225
238
 
226
239
  # A column definition in the DDL that carries a parenthesised type
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module BeagleTurso
5
- VERSION = "0.1.5"
5
+ VERSION = "0.1.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-beagle-turso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - BeagleSoftwareUK