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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a1a95bf62c876f996098db6a065aa9157af882b13d5038c7a86226ea6514b8b
|
|
4
|
+
data.tar.gz: 36d1eb3bdaf31d214ca80a1ab3754323cec795172bf00e2bcfd78d6812a7b3d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|