studio-engine 0.47.0 → 0.47.1

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: d1da7736255e9cf6690f07488e8758227bd6231e08502d123dcbefbdd6f6c685
4
- data.tar.gz: a8e2e861599996fdb22203bb9ed42feae6f5343232a1c0578c73fd95f28b8b81
3
+ metadata.gz: 90659c9a1e1cd62a432e47529501574cca5f7a217f48b6f0eaf0990198150636
4
+ data.tar.gz: 23435ace6999ecb78b5ad57c2a7c90cf8da64cee0415feb1d5a2fd82f65d4470
5
5
  SHA512:
6
- metadata.gz: 6f1effe6341c220633e267f9382cf5dc2ca68565565489b95feceb744003aceaca151663a0cdba25c7c11753f99ac78369c4c4327232436628f55b30c40afcf1
7
- data.tar.gz: 33526cb24c80fc6e26ada46d15fbbd5701f5681af7cd4a9feaab2bfcea6c92e8283b7d50d1408cc8f160c2624ed5038968509fbb37ae3783ae003f0381ef1500
6
+ metadata.gz: 5c964c5081845ae99315fe62fe98fde0969255d779537524aeb0abbde5b8ceb5fab3ee98c5771471c992b3628021e35e6b42a5f91dc5909bbb3601fd9dabbe1d
7
+ data.tar.gz: 8c1e90e63006085ef8745ba6a5d1e06b004e09e4c74c523780be2ae9f7e024b3b426aa228dc22eeea683459820a3a9a079720d27e8c8905e90c4796999595d2d
@@ -34,8 +34,37 @@
34
34
  # belong to Studio::IpLocations — the column is just where it lands. It holds
35
35
  # IP-derived location data, which is personal data in most jurisdictions; the
36
36
  # 50-entry cap there bounds it, and no app writes to it until it opts in.
37
+ # ON THE DOWN: this migration REFUSES to reverse, deliberately.
38
+ #
39
+ # `up` is idempotent by design — every add is `if_not_exists`, precisely so it can
40
+ # run against apps that already disagree. That guard is what makes it safe going
41
+ # in, and it is exactly what makes an honest `down` impossible: the migration
42
+ # records NOTHING about which columns it actually created on this host.
43
+ #
44
+ # So a `down` cannot tell "I added this" from "the host has had it since 2024":
45
+ #
46
+ # - mcritchie-studio owned `users.first_name` BEFORE this ran.
47
+ # - turf-monster owned `users.first_name` AND `users.birth_year`.
48
+ # - mcritchie-industries owned none of the five.
49
+ #
50
+ # The two apps the `up` was careful not to touch are the two a `DROP COLUMN`
51
+ # would rob. Rails' auto-inverse does precisely that: `INVERT_METHODS` maps
52
+ # `add_column` to `remove_column` and passes the same options through, and
53
+ # `remove_column` honours only `if_exists`. A stray `if_not_exists:` there is
54
+ # silently DISCARDED rather than raising.
55
+ #
56
+ # `if_exists` is NOT the fix, and it is worth saying why since it is the reflex:
57
+ # it asks "does this column exist?" — and on those two apps it does. That is the
58
+ # whole hazard. `if_exists` only protects a SECOND rollback, after the data is
59
+ # already gone.
60
+ #
61
+ # Refusing turns silent data loss into a loud, actionable error. An operator who
62
+ # genuinely wants these columns gone can drop the ones they know they own, by
63
+ # hand, with the schema in front of them.
37
64
  class AddStandardUserProfileColumns < ActiveRecord::Migration[7.2]
38
- def change
65
+ COLUMNS = %i[first_name birth_day birth_month birth_year ip_locations].freeze
66
+
67
+ def up
39
68
  # An app that has no users table (the engine's dummy, and any future
40
69
  # consumer that names its accounts something else) is simply skipped.
41
70
  return unless table_exists?(:users)
@@ -48,4 +77,22 @@ class AddStandardUserProfileColumns < ActiveRecord::Migration[7.2]
48
77
 
49
78
  add_column :users, :ip_locations, :jsonb, default: [], null: false, if_not_exists: true
50
79
  end
80
+
81
+ def down
82
+ # Nothing was added, so nothing is owed — an app without `users` never ran
83
+ # the `up` body either, and reversing that is genuinely a no-op.
84
+ return unless table_exists?(:users)
85
+
86
+ raise ActiveRecord::IrreversibleMigration, <<~MSG
87
+ AddStandardUserProfileColumns cannot be reversed safely.
88
+
89
+ Its `up` adds #{COLUMNS.join(", ")} with `if_not_exists`, so it does not
90
+ know which of them it created on this host and which the host already
91
+ owned. Dropping them all would destroy host-owned data (mcritchie-studio
92
+ owned first_name; turf-monster owned first_name and birth_year).
93
+
94
+ If you truly want a column gone, drop the ones you know this app did not
95
+ own before the migration, by hand, in their own migration.
96
+ MSG
97
+ end
51
98
  end
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.47.0"
2
+ VERSION = "0.47.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.47.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-13 00:00:00.000000000 Z
11
+ date: 2026-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails