mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* Implement entry protection flags for sync overwrites - Added `user_modified` and `import_locked` flags to `entries` table to prevent provider sync from overwriting user-edited and imported data. - Introduced backfill migration to mark existing entries based on conditions. - Enhanced sync and processing logic to respect protection flags, track skipped entries, and log detailed stats. - Updated UI to display skipped/protected entries and reasons in sync summaries. * Localize error details summary text and adjust `sync_account_later` method placement * Restored schema.rb --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
18 lines
997 B
Ruby
18 lines
997 B
Ruby
class AddEntryProtectionFlags < ActiveRecord::Migration[7.2]
|
|
def change
|
|
# user_modified: Set when user manually edits any field on an entry.
|
|
# Prevents provider sync from overwriting user's intentional changes.
|
|
# Does NOT prevent user from editing - only protects from automated overwrites.
|
|
add_column :entries, :user_modified, :boolean, default: false, null: false
|
|
|
|
# import_locked: Set when entry is created via CSV/manual import.
|
|
# Prevents provider sync from overwriting imported data.
|
|
# Does NOT prevent user from editing - only protects from automated overwrites.
|
|
add_column :entries, :import_locked, :boolean, default: false, null: false
|
|
|
|
# Partial indexes for efficient queries when filtering protected entries
|
|
add_index :entries, :user_modified, where: "user_modified = true", name: "index_entries_on_user_modified_true"
|
|
add_index :entries, :import_locked, where: "import_locked = true", name: "index_entries_on_import_locked_true"
|
|
end
|
|
end
|