-
-
Notifications
You must be signed in to change notification settings - Fork 11k
Removed updated_by
& created_by
fields
#24053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis change set systematically removes the Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.38.1)ghost/core/test/legacy/models/model_posts.test.js🔧 ESLint
ghost/admin/mirage/fixtures/settings.jsOops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
ghost/admin/mirage/fixtures/roles.jsOops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
821c91d
to
5de7e2a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 6.x #24053 +/- ##
==========================================
- Coverage 71.34% 71.32% -0.03%
==========================================
Files 1534 1534
Lines 114055 113998 -57
Branches 13700 13688 -12
==========================================
- Hits 81373 81306 -67
- Misses 31643 31653 +10
Partials 1039 1039
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6ec431d
to
ac86419
Compare
Removed the `updated_by` field from everywhere as it is deprecated and no longer used. Removing this field also makes future changes related to the removal of the hardcoded owner user id (`1`) by removing a code path that will use this hardcoded owner user id. There are still some references to `updated_by` and these are intentional: 1. Old migration files (versions 4.x) - These should NOT be modified as they represent historical database state 2. Test files checking that updated_by is stripped - These are correct and should remain 3. Export/import JSON fixtures in content/data - These are data export files and shouldn't be modified 4. Our new migration file - This is the file that removes `updated_by` columns, so it correctly references them 5. Test fixtures - Some JSON test fixtures still contain updated_by but these represent test data for import/export functionality
fb5d623
to
8e0e130
Compare
0873c94
to
56a0a5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
ghost/core/core/server/data/schema/schema.js (1)
1-1100
: Consider audit trail and compliance implications.The systematic removal of
created_by
andupdated_by
fields eliminates user-level audit tracking capabilities. While this aligns with the goal of removing hardcoded user dependencies, consider the following implications:
- Compliance Requirements: Some regulatory frameworks require tracking of record modifications by user
- Forensic Capabilities: Loss of user attribution for data changes
- Migration Timing: Ensure schema changes are coordinated with application deployment to prevent runtime errors
Consider implementing alternative audit mechanisms if user-level tracking becomes necessary in the future, such as:
- Event-sourcing patterns for critical operations
- Application-level audit logs separate from the main schema
- Integration with external audit systems
🧹 Nitpick comments (2)
ghost/core/test/utils/fixtures/urls/resources.json (1)
709-726
: Fixture still contains duplicated tag records – consider deduplicating.IDs
618ba1febe2896088840a6db
,9451f5fca366002ebd5dbea6
, and618ba1fdbe2896088840a675
each appear twice (reserved = true/false).
Unless a test explicitly relies on this duplication, trimming duplicates will speed up fixture loading and reduce cognitive overhead.Also applies to: 763-780, 817-834
ghost/core/test/utils/fixtures/data-generator.js (1)
1290-1301
: DRY-up opportunity: reusecreateBasic
to avoid timestamp/id duplication
createSetting
re-implements theid
,created_at
, andupdated_at
fields thatcreateBasic()
already provides elsewhere in this file. Switching to the shared helper keeps the factories consistent and reduces maintenance effort.- return _.defaults(newObj, { - id: ObjectId().toHexString(), - uuid: '95ce1c53-69b0-4f5f-be91-d3aeb39046b5', - key: 'title', - value: null, - type: 'site', - created_at: new Date(), - updated_at: new Date() - }); + return _.defaults(newObj, Object.assign({ + uuid: '95ce1c53-69b0-4f5f-be91-d3aeb39046b5', + key: 'title', + value: null, + type: 'site' + }, createBasic()));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
ghost/core/test/e2e-api/admin/__snapshots__/session.test.js.snap
is excluded by!**/*.snap
📒 Files selected for processing (58)
ghost/admin/app/serializers/application.js
(0 hunks)ghost/admin/mirage/fixtures/roles.js
(1 hunks)ghost/admin/mirage/fixtures/settings.js
(1 hunks)ghost/core/core/server/api/endpoints/utils/serializers/output/all.js
(1 hunks)ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/snippets.js
(1 hunks)ghost/core/core/server/api/endpoints/utils/serializers/output/members.js
(0 hunks)ghost/core/core/server/data/importer/importers/data/Base.js
(1 hunks)ghost/core/core/server/data/importer/importers/data/SettingsImporter.js
(0 hunks)ghost/core/core/server/data/migrations/utils/permissions.js
(1 hunks)ghost/core/core/server/data/migrations/utils/settings.js
(2 hunks)ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-01-41-54-remove-updated-by-column.js
(1 hunks)ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-13-41-55-remove-created-by-column.js
(1 hunks)ghost/core/core/server/data/schema/fixtures/fixtures.json
(0 hunks)ghost/core/core/server/data/schema/schema.js
(13 hunks)ghost/core/core/server/data/seeders/importers/EmailsImporter.js
(1 hunks)ghost/core/core/server/data/seeders/importers/LabelsImporter.js
(1 hunks)ghost/core/core/server/data/seeders/importers/MembersImporter.js
(0 hunks)ghost/core/core/server/data/seeders/importers/MembersStripeCustomersImporter.js
(1 hunks)ghost/core/core/server/data/seeders/importers/MembersStripeCustomersSubscriptionsImporter.js
(0 hunks)ghost/core/core/server/data/seeders/importers/PostsImporter.js
(0 hunks)ghost/core/core/server/data/seeders/importers/TagsImporter.js
(1 hunks)ghost/core/core/server/data/seeders/importers/UsersImporter.js
(1 hunks)ghost/core/core/server/models/base/plugins/events.js
(0 hunks)ghost/core/core/server/models/post.js
(1 hunks)ghost/core/core/server/models/settings.js
(1 hunks)ghost/core/core/server/models/user.js
(2 hunks)ghost/core/core/server/services/activitypub/ActivityPubService.ts
(1 hunks)ghost/core/core/server/services/link-redirection/README.md
(1 hunks)ghost/core/test/e2e-api/admin/posts-legacy.test.js
(16 hunks)ghost/core/test/e2e-api/admin/utils.js
(0 hunks)ghost/core/test/integration/importer/v2.test.js
(5 hunks)ghost/core/test/integration/services/email-service/batch-sending.test.js
(1 hunks)ghost/core/test/legacy/api/admin/posts.test.js
(1 hunks)ghost/core/test/legacy/api/admin/schedules.test.js
(0 hunks)ghost/core/test/legacy/api/content/authors.test.js
(2 hunks)ghost/core/test/legacy/api/content/pages.test.js
(2 hunks)ghost/core/test/legacy/api/content/posts.test.js
(2 hunks)ghost/core/test/legacy/api/content/utils.js
(0 hunks)ghost/core/test/legacy/models/model_posts.test.js
(1 hunks)ghost/core/test/legacy/models/model_settings.test.js
(1 hunks)ghost/core/test/unit/api/canary/utils/serializers/output/all.test.js
(4 hunks)ghost/core/test/unit/api/canary/utils/serializers/output/mapper.test.js
(1 hunks)ghost/core/test/unit/api/canary/utils/validators/input/pages.test.js
(0 hunks)ghost/core/test/unit/api/canary/utils/validators/input/posts.test.js
(0 hunks)ghost/core/test/unit/api/canary/utils/validators/input/tags.test.js
(1 hunks)ghost/core/test/unit/api/canary/utils/validators/input/webhooks.test.js
(1 hunks)ghost/core/test/unit/server/data/migrations/utils.test.js
(3 hunks)ghost/core/test/unit/server/data/schema/integrity.test.js
(1 hunks)ghost/core/test/unit/server/data/schema/validator.test.js
(1 hunks)ghost/core/test/unit/server/services/activitypub/ActivityPubService.test.ts
(0 hunks)ghost/core/test/utils/batch-email-utils.js
(0 hunks)ghost/core/test/utils/fixtures/data-generator.js
(1 hunks)ghost/core/test/utils/fixtures/filter-param/index.js
(1 hunks)ghost/core/test/utils/fixtures/fixtures.json
(0 hunks)ghost/core/test/utils/fixtures/import/import-data-1.json
(1 hunks)ghost/core/test/utils/fixtures/import/import-data-lts.json
(1 hunks)ghost/core/test/utils/fixtures/urls/resources.json
(9 hunks)ghost/core/test/utils/fixtures/urls/urls.json
(6 hunks)
💤 Files with no reviewable changes (16)
- ghost/core/core/server/data/seeders/importers/MembersStripeCustomersSubscriptionsImporter.js
- ghost/core/test/unit/server/services/activitypub/ActivityPubService.test.ts
- ghost/core/test/legacy/api/admin/schedules.test.js
- ghost/core/test/unit/api/canary/utils/validators/input/pages.test.js
- ghost/core/core/server/data/schema/fixtures/fixtures.json
- ghost/core/core/server/data/seeders/importers/MembersImporter.js
- ghost/core/core/server/data/seeders/importers/PostsImporter.js
- ghost/core/test/legacy/api/content/utils.js
- ghost/core/test/e2e-api/admin/utils.js
- ghost/admin/app/serializers/application.js
- ghost/core/core/server/data/importer/importers/data/SettingsImporter.js
- ghost/core/test/utils/fixtures/fixtures.json
- ghost/core/core/server/api/endpoints/utils/serializers/output/members.js
- ghost/core/test/unit/api/canary/utils/validators/input/posts.test.js
- ghost/core/test/utils/batch-email-utils.js
- ghost/core/core/server/models/base/plugins/events.js
🔇 Additional comments (57)
ghost/core/core/server/services/activitypub/ActivityPubService.ts (1)
130-130
: Clean removal of deprecated user attribution field.The removal of
created_by: '1'
from webhook insertion aligns perfectly with the PR objectives to eliminate hardcoded user references and deprecated attribution fields. Preservingcreated_at
maintains proper audit trails.ghost/core/core/server/data/seeders/importers/MembersStripeCustomersImporter.js (1)
54-54
: Consistent removal of unused attribution field.The removal of
created_by: 'unused'
from the data generation aligns with the systematic cleanup effort. The field was not providing meaningful value and its removal simplifies the data model.ghost/core/core/server/data/seeders/importers/UsersImporter.js (1)
25-25
: Proper removal of deprecated field in user data generation.The removal of
created_by: 'unused'
follows the consistent pattern across all importers. The preservation ofcreated_at
with realistic timestamp generation maintains data integrity for testing purposes.ghost/core/core/server/data/seeders/importers/EmailsImporter.js (1)
92-92
: Complete removal of both deprecated attribution fields.The removal of both
created_by: 'unused'
andupdated_by: 'unused'
demonstrates thorough cleanup. Preservingupdated_at
maintains proper audit trails for email tracking and status updates.ghost/core/core/server/api/endpoints/utils/serializers/output/all.js (1)
9-9
: Logical update to serialization filtering.The modification to only filter
published_by
is correct sincecreated_by
andupdated_by
fields are being removed from the database schema entirely. This change aligns the serialization logic with the new data model.ghost/core/test/utils/fixtures/import/import-data-1.json (1)
67-67
: LGTM: Clean removal of deprecated fieldsThe JSON structure is properly maintained after removing the
created_by
andupdated_by
fields from the tag object, with correct comma handling.ghost/admin/mirage/fixtures/roles.js (1)
8-8
: LGTM: Consistent field removal across all role fixturesAll role objects have been properly updated to remove the deprecated
created_by
andupdated_by
fields while maintaining correct JavaScript object syntax.Also applies to: 15-15, 22-22, 29-29, 36-36, 43-43
ghost/core/test/utils/fixtures/filter-param/index.js (1)
42-42
: LGTM: Clean removal of created_by fields from tag fixturesThe
created_by
fields have been properly removed from all tag objects in the test fixture data, maintaining correct JavaScript syntax and consistency with the PR objective.Also applies to: 49-49, 56-56, 64-64, 69-69, 74-74
ghost/core/test/legacy/api/content/pages.test.js (1)
34-34
: LGTM: Proper removal of deprecated created_by field from test user insertionsThe
created_by
field has been correctly removed from user insertions in both test cases. The test logic for filtering functionality remains unaffected.Also applies to: 73-73
ghost/core/test/legacy/api/content/authors.test.js (1)
33-33
: LGTM: Consistent removal of deprecated created_by fieldThe
created_by
field has been properly removed from user insertions in both test cases, aligning with the broader effort to eliminate these deprecated fields while preserving test functionality.Also applies to: 72-72
ghost/core/test/utils/fixtures/import/import-data-lts.json (1)
58-59
: LGTM! Consistent field removal in test fixture.The removal of
created_by
andupdated_by
fields from the tags object aligns with the systematic deprecation of these user attribution fields while preserving the timestamp field.ghost/core/test/unit/api/canary/utils/validators/input/tags.test.js (1)
107-128
: LGTM! Test correctly reflects validation changes.The test data and assertions are properly updated to match the removal of
created_by
andupdated_by
fields from the validation logic. The test now only verifies stripping of the remaining fields that should be excluded from tag input.ghost/core/test/legacy/api/content/posts.test.js (2)
30-38
: LGTM! Consistent field removal from test user data.The removal of
created_by
field from the test user record aligns with the schema changes while maintaining all necessary fields for the test functionality.
69-77
: LGTM! Consistent field removal from test user data.The removal of
created_by
field from the second test user record maintains consistency with the schema changes while preserving test functionality.ghost/core/test/utils/fixtures/urls/urls.json (6)
19-19
: LGTM! Systematic removal of deprecated user attribution fields.The removal of
created_by
andupdated_by
fields from the author object is consistent with the broader deprecation effort while preserving necessary timestamp fields.
563-563
: LGTM! Consistent field removal from tag fixtures.The removal of
created_by
andupdated_by
fields from the tag object maintains consistency with the schema changes while preserving timestamp fields.
588-588
: LGTM! Consistent field removal from author fixtures.The removal of
created_by
andupdated_by
fields from the author object aligns with the systematic deprecation of these user attribution fields.
709-709
: LGTM! Consistent field removal from tag fixtures.The removal of
created_by
andupdated_by
fields from the tag object maintains consistency across all fixture data.
740-740
: LGTM! Consistent field removal from tag fixtures.The removal of
created_by
andupdated_by
fields from the tag object completes the systematic cleanup of these deprecated fields.
812-812
: LGTM! Consistent field removal from tag fixtures.The removal of
created_by
andupdated_by
fields from the final tag object maintains consistency throughout the fixture file.ghost/core/core/server/models/user.js (2)
79-79
: LGTM! Minor formatting improvement.The added space in the if condition improves code readability without any functional change.
779-779
: LGTM! Documentation formatting fix.The whitespace correction in the JSDoc comment improves documentation consistency.
ghost/core/core/server/services/link-redirection/README.md (1)
80-80
: Documentation updated correctly to reflect field removal.The SQL statement documentation has been appropriately updated to exclude the deprecated
created_by
andupdated_by
fields from the member update query.ghost/core/test/unit/api/canary/utils/serializers/output/mapper.test.js (1)
183-183
: Test expectation correctly updated to reflect serializer changes.The test now properly excludes
created_by
andupdated_by
from the expected snippet mapper output, aligning with the updated serialization logic.ghost/admin/mirage/fixtures/settings.js (1)
15-15
: Fixture function correctly updated to exclude deprecated fields.The setting fixture function has been properly modified to remove
created_by
andupdated_by
properties while retaining the timestamp fields.ghost/core/test/unit/server/data/schema/validator.test.js (2)
26-26
: Validation error count correctly updated.The expected error count has been appropriately reduced from 6 to 5 to reflect the removal of the
created_by
field validation requirement.
33-33
: Field validation list properly updated.The test now correctly validates only the remaining required fields: id, uuid, slug, title, and created_at, excluding the removed
created_by
field.ghost/core/test/legacy/models/model_settings.test.js (1)
36-36
: Test database insertion correctly updated.The test has been properly modified to exclude the deprecated
created_by
andupdated_by
fields from the database insertion, preventing potential test failures due to missing columns.ghost/core/core/server/data/seeders/importers/TagsImporter.js (1)
35-35
: LGTM: Clean removal of deprecated field.The removal of the
created_by
field assignment aligns perfectly with the PR objective to eliminate deprecated user attribution fields. The essentialcreated_at
timestamp is preserved, maintaining proper audit trail functionality.ghost/core/test/unit/api/canary/utils/validators/input/webhooks.test.js (1)
124-124
: LGTM: Test updated to reflect removal of deprecated fields.The test correctly removes
created_by
andupdated_by
from the webhook test data, aligning with their systematic removal across the codebase. The test logic for field stripping validation remains intact and appropriate.ghost/core/core/server/data/importer/importers/data/Base.js (1)
289-290
: LGTM: User reference processing updated correctly.The removal of
'created_by'
and'updated_by'
from the user reference fields array is appropriate since these fields are being eliminated from the database schema. The remaining user references ('author_id'
and'published_by'
) continue to be processed correctly during import operations.ghost/core/test/unit/server/data/schema/integrity.test.js (1)
38-39
: LGTM: Schema and fixtures integrity hashes updated correctly.The updated MD5 hash values appropriately reflect the systematic removal of
created_by
andupdated_by
fields from the database schema and fixtures. This ensures the integrity test continues to function properly after the schema modifications.ghost/core/test/integration/services/email-service/batch-sending.test.js (1)
534-534
: LGTM: Test data cleaned up to remove deprecated fields.The removal of
created_by
andupdated_by
fields from the test post object correctly reflects the updated data model. The test maintains its core functionality for email verification requirements while using consistent data structures.ghost/core/test/utils/fixtures/urls/resources.json (1)
670-672
: Confirm all downstream code/tests no longer expectcreated_by
/updated_by
.The fixture update looks correct, but any reader that still dereferences the removed keys will now raise
undefined
/null
errors.
Please sanity-check the entire codebase (migrations, serializers, import/export helpers, and test assertions) for lingering references.#!/bin/bash # Search the whole repo for any remaining `created_by` / `updated_by` references. rg -n --no-heading -e '"created_by"' -e '"updated_by"' -e '\.created_by' -e '\.updated_by'Also applies to: 697-699, 725-726, 752-753, 806-807, 833-834, 856-857, 877-878
ghost/core/test/legacy/models/model_posts.test.js (1)
1833-1834
: LGTM: Test correctly updated to remove deprecated fields.The test properly removes assertions for
created_by
andupdated_by
properties, which aligns with their systematic removal from the codebase.ghost/core/core/server/data/seeders/importers/LabelsImporter.js (1)
27-36
: LGTM: Correctly removes deprecated user attribution fields.The
generate()
method appropriately removescreated_by
andupdated_by
fields while preserving the necessary timestamp fields (created_at
andupdated_at
). This aligns with the systematic removal of these deprecated fields across the codebase.ghost/core/test/unit/api/canary/utils/serializers/output/all.test.js (1)
6-63
: LGTM: Test correctly updated to reflect new serialization behavior.The test properly updates all references from
created_by
/updated_by
topublished_by
, which aligns with the changes to the serializer'sremoveXBY
function that now only removespublished_by
fields. The test coverage remains comprehensive while reflecting the new field filtering behavior.ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/snippets.js (1)
7-29
: LGTM: Correctly removes deprecated fields from snippet serialization.The mapper function and JSDoc typedef are properly updated to exclude
created_by
andupdated_by
fields from the serialized snippet output. This maintains consistency with the systematic removal of these deprecated user attribution fields across the codebase.ghost/core/test/legacy/api/admin/posts.test.js (1)
796-796
: LGTM! Test name accurately reflects updated scope.The test name change from "update dates & x_by" to "update dates" correctly reflects that the test now only verifies the immutability of
created_at
andupdated_at
fields, aligning with the removal ofcreated_by
andupdated_by
fields from the codebase.ghost/core/core/server/data/migrations/utils/permissions.js (1)
33-50
: Excellent backward-compatible migration pattern.The conditional logic for
created_by
andupdated_by
fields is well-implemented:
- Uses
connection.schema.hasColumn
to check column existence before inclusion- Ensures migrations work both before and after column removal
- Maintains consistency between both audit fields
- Follows defensive programming practices for schema evolution
This approach prevents migration failures during the transition period when these columns may or may not exist.
ghost/core/test/e2e-api/admin/posts-legacy.test.js (1)
269-270
: Removal of obsolete attribution fields looks goodAll touched object literals have dropped the deprecated
created_by
/updated_by
fields while retainingupdated_at
for optimistic-locking. Nothing else in the tests relies on those removed fields, so behaviour and assertions remain intact.No further action needed.
Also applies to: 605-606, 647-648, 703-704, 772-773, 840-841, 912-913, 982-983, 1050-1051, 1120-1121, 1212-1214, 1300-1301, 1390-1391, 1487-1488, 1668-1669, 1730-1731
ghost/core/test/utils/fixtures/data-generator.js (2)
1293-1301
: Removal ofcreated_by/updated_by
attributes is consistent – LGTMThe
createSetting
factory now limits itself tocreated_at
/updated_at
timestamps, aligning with the wider schema change. No functional issues spotted.
1290-1301
: Sanity-check: ensure no straycreated_by
/updated_by
usages remainTo be extra safe after this large-scale removal, run a quick grep to verify the repo is now free of the deprecated columns.
#!/bin/bash # Find any remaining references to removed audit columns rg -n --ignore-case --no-heading 'created_by|updated_by'ghost/core/test/integration/importer/v2.test.js (2)
419-423
: LGTM! Test expectations updated correctly for removed fields.The test now expects only 1 problem instead of 3, correctly accounting for the removal of
created_by
andupdated_by
from user reference validation. The error message appropriately excludes these fields and focuses only onauthor_id
andpublished_by
references.
534-536
: LGTM! Test data generation updated consistently.The test data generation has been correctly updated to exclude
created_by
andupdated_by
fields from user and tag creation. These changes are consistent with the schema updates and ensure tests align with the new data model.Also applies to: 578-585, 1203-1212
ghost/core/test/unit/server/data/migrations/utils.test.js (2)
224-225
: LGTM! Test database schema updated correctly.The test database setup functions have been properly updated to exclude
created_by
andupdated_by
fields from both schema creation and data insertion. This ensures migration utility tests work correctly with the updated database schema.Also applies to: 232-233, 241-242
661-661
: LGTM! Test data insertion updated consistently.The settings test data insertion correctly excludes the
created_by
field, maintaining consistency with the schema changes throughout the test utilities.ghost/core/core/server/models/settings.js (1)
300-300
: LGTM! Settings model updated correctly for field removal.The
populateDefaults
method has been properly updated to excludecreated_by
andupdated_by
field assignment. This change aligns with the database schema modifications and the removal of owner user retrieval logic earlier in the method.ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-01-41-54-remove-updated-by-column.js (2)
4-16
: LGTM! Robust helper function with proper safety checks.The
dropUpdatedBy
helper function correctly checks for column existence before attempting to drop it, which prevents errors in environments where the migration might be run multiple times. The logging provides good visibility into the migration progress.
18-46
: LGTM! Comprehensive migration covering all relevant tables.The migration properly covers all tables that had
updated_by
columns, uses non-transactional migration appropriately for schema changes, and correctly indicates that the down migration is not supported for this major version change. The logging provides clear feedback on migration progress.ghost/core/core/server/data/migrations/utils/settings.js (2)
31-49
: LGTM! Excellent backward-compatible migration pattern.The conditional schema checks ensure this migration utility works correctly both before and after the
created_by
/updated_by
columns are removed. This is the proper approach for phased field removal.
110-129
: Consistent implementation in the down migration.The same conditional logic is properly applied in the
removeSetting
down function, maintaining consistency with the up migration pattern.ghost/core/core/server/models/post.js (1)
604-624
: Well-implemented scheduler touch logic.This logic effectively handles the edge case where scheduled posts are updated close to their publish time. The implementation is safe and efficient:
- Clear conditional checks for the specific scenario
- Safe "touch" mechanism that doesn't persist dummy data
- Proper event detection through the changed object
ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-13-41-55-remove-created-by-column.js (3)
4-16
: Robust helper function with proper safeguards.The
dropCreatedBy
helper function correctly checks for column existence before attempting to drop it, preventing errors if the column has already been removed. The logging provides good visibility into the migration process.
18-41
: Comprehensive table coverage with proper coordination.The migration systematically removes
created_by
from all relevant tables. The sequential approach and logging ensure transparency during the migration process.
43-46
: Appropriate handling of irreversible migration.The down migration correctly acknowledges that this is a major version change that cannot be safely reverted, which aligns with the nature of removing core schema columns.
ghost/core/core/server/data/schema/schema.js (1)
184-184
: ```shell
#!/bin/bash
echo "=== remove-created-by migration ==="
sed -n '1,200p' ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-13-41-55-remove-created-by-column.jsecho -e "\n=== remove-updated-by migration ==="
sed -n '1,200p' ghost/core/core/server/data/migrations/versions/6.0/2025-06-20-01-41-54-remove-updated-by-column.js</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 Removed `updated_by` & `created_by` fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id `1`) --------- Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597 ref #24053 Removed `updatedBy` & `createdBy` fields in the admin app as they are deprecated and should not be being used anywhere meaningful in the codebase
ref https://linear.app/ghost/issue/PROD-1597
Removed
updated_by
&created_by
fields as they are deprecated and should not be being used anywhere meaningful in the codebase. Removal of these fields is a prerequisite for the work needed for https://linear.app/ghost/issue/PROD-1594 (removal of hardocded owner user id1
)