activerecord-virgodb-adapter 0.1.8 → 0.1.9
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: c9adcef53b08377de04eaa8a3efb42a9ef26af8c9d21d354417a9431374ffb5b
|
|
4
|
+
data.tar.gz: '089277465d82f97c0075bb1641c46bd37e02a3c44d0e3f627d02962a473bfcfd'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7c81193bd344ef5e4120c7147e4374d5421fb17e129937b829bb6f01fcc59ec8e1734916f7c85e2a07ff3b66687a09de0cc361a6489bc85459fb4e086083894
|
|
7
|
+
data.tar.gz: 5df55c10f41ff7fd8264e561e470966fa3b9aadf8e7691304f6ad0d8336fb0939780782df4c03a33b68369f691a357ca70a146261f3f812c891c7c5ada66a2e9
|
|
@@ -458,8 +458,8 @@ module ActiveRecord
|
|
|
458
458
|
next_version = (select_value("SELECT MAX(version) FROM schema_versions WHERE table_name = #{quote(table_name)}") || 0).to_i + 1
|
|
459
459
|
|
|
460
460
|
execute(<<~SQL)
|
|
461
|
-
INSERT INTO schema_versions (table_name, version, columns
|
|
462
|
-
VALUES (#{quote(table_name)}, #{next_version}, #{quote(cols.to_json)}
|
|
461
|
+
INSERT INTO schema_versions (table_name, version, columns)
|
|
462
|
+
VALUES (#{quote(table_name)}, #{next_version}, #{quote(cols.to_json)})
|
|
463
463
|
SQL
|
|
464
464
|
end
|
|
465
465
|
|
|
@@ -471,14 +471,21 @@ module ActiveRecord
|
|
|
471
471
|
# in manifest/src/lib.rs for why (breaks a real structure_dump/
|
|
472
472
|
# structure_load round trip the moment any host app's
|
|
473
473
|
# ActiveRecord::SchemaDumper.ignore_tables is non-empty).
|
|
474
|
+
#
|
|
475
|
+
# No `applied_at` column (removed -- nothing ever read it back, see
|
|
476
|
+
# manifest/src/lib.rs's matching comment on `register_schema_version`).
|
|
477
|
+
# Breaking format change, no in-place migration: `IF NOT EXISTS` is a
|
|
478
|
+
# no-op against a manifest that already has the old `applied_at NOT
|
|
479
|
+
# NULL` shape, so `insert_schema_version!` above would fail against
|
|
480
|
+
# one -- deliberate, pre-production, existing manifests get dropped
|
|
481
|
+
# and recreated rather than migrated.
|
|
474
482
|
def ensure_schema_versions_table!
|
|
475
483
|
execute(<<~SQL)
|
|
476
484
|
CREATE TABLE IF NOT EXISTS schema_versions (
|
|
477
485
|
id INTEGER PRIMARY KEY,
|
|
478
486
|
table_name TEXT NOT NULL,
|
|
479
487
|
version INTEGER NOT NULL,
|
|
480
|
-
columns TEXT NOT NULL
|
|
481
|
-
applied_at INTEGER NOT NULL
|
|
488
|
+
columns TEXT NOT NULL
|
|
482
489
|
)
|
|
483
490
|
SQL
|
|
484
491
|
end
|
|
@@ -141,21 +141,14 @@ module ActiveRecord
|
|
|
141
141
|
# columns against the CURRENT version, which is exactly what's still
|
|
142
142
|
# dumped.
|
|
143
143
|
#
|
|
144
|
-
# `
|
|
145
|
-
#
|
|
144
|
+
# `schema_versions` has no `applied_at` column as of this adapter
|
|
145
|
+
# version (removed from the manifest's own schema, see
|
|
146
|
+
# manifest/src/lib.rs's matching comment on `register_schema_version`
|
|
147
|
+
# -- nothing ever read it back). It used to carry real wall-clock data
|
|
146
148
|
# (`Time.now.to_i` at migration time), which made this file diff on
|
|
147
149
|
# every clean rebuild (`db:drop` + `db:migrate`) even when the actual
|
|
148
|
-
# schema hadn't changed at all
|
|
149
|
-
#
|
|
150
|
-
# above), and this adapter's own `assert_additive!`/
|
|
151
|
-
# `record_added_column!` only ever read `columns` too. The live
|
|
152
|
-
# manifest's real `schema_versions` table is untouched by this --
|
|
153
|
-
# `applied_at` still gets a real timestamp there at migration time,
|
|
154
|
-
# useful for a human inspecting the live table directly. This only
|
|
155
|
-
# changes what a fresh `structure_load` seeds into a NEW database,
|
|
156
|
-
# where a wall-clock value was never reproducible enough to belong in
|
|
157
|
-
# a checked-in file meant to represent "current schema shape," not
|
|
158
|
-
# "when someone last regenerated this file."
|
|
150
|
+
# schema hadn't changed at all -- that's gone now along with the
|
|
151
|
+
# column, not just papered over here.
|
|
159
152
|
def dump_schema_versions!(filename)
|
|
160
153
|
return unless connection.data_source_exists?("schema_versions")
|
|
161
154
|
|
|
@@ -169,10 +162,9 @@ module ActiveRecord
|
|
|
169
162
|
|
|
170
163
|
pretty_columns = JSON.pretty_generate(JSON.parse(latest["columns"]))
|
|
171
164
|
f.puts(
|
|
172
|
-
"INSERT INTO \"schema_versions\" (id, table_name, version, columns
|
|
165
|
+
"INSERT INTO \"schema_versions\" (id, table_name, version, columns) VALUES (\n" \
|
|
173
166
|
" #{latest['id']}, #{connection.quote(table_name)}, #{latest['version']},\n" \
|
|
174
|
-
" #{connection.quote(pretty_columns)}
|
|
175
|
-
" 0\n" \
|
|
167
|
+
" #{connection.quote(pretty_columns)}\n" \
|
|
176
168
|
");"
|
|
177
169
|
)
|
|
178
170
|
f.puts
|