1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

Add migration to clear stale syncs on self hosted apps

This commit is contained in:
Zach Gollwitzer 2025-05-14 12:52:21 -04:00
parent 0ff128b942
commit 153bffcaf2
4 changed files with 17 additions and 13 deletions

View file

@ -241,15 +241,6 @@
stroke-dashoffset: 0; stroke-dashoffset: 0;
} }
} }
@keyframes shiny-wave {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
} }
/* Specific override for strong tags in prose under dark mode */ /* Specific override for strong tags in prose under dark mode */

View file

@ -87,7 +87,7 @@ class UsersController < ApplicationController
def user_params def user_params
params.require(:user).permit( params.require(:user).permit(
:first_name, :last_name, :email, :profile_image, :redirect_to, :delete_profile_image, :onboarded_at, :preferred_account_group_tab, :first_name, :last_name, :email, :profile_image, :redirect_to, :delete_profile_image, :onboarded_at,
:show_sidebar, :default_period, :show_ai_sidebar, :ai_enabled, :theme, :set_onboarding_preferences_at, :set_onboarding_goals_at, :show_sidebar, :default_period, :show_ai_sidebar, :ai_enabled, :theme, :set_onboarding_preferences_at, :set_onboarding_goals_at,
family_attributes: [ :name, :currency, :country, :locale, :date_format, :timezone, :id ], family_attributes: [ :name, :currency, :country, :locale, :date_format, :timezone, :id ],
goals: [] goals: []

View file

@ -28,6 +28,20 @@ class UpdateSyncTimestamps < ActiveRecord::Migration[7.2]
UPDATE syncs UPDATE syncs
SET window_start_date = start_date SET window_start_date = start_date
SQL SQL
# Due to some recent bugs, some self hosters have syncs that are stuck.
# This manually fails those syncs so they stop seeing syncing UI notices.
if Rails.application.config.app_mode.self_hosted?
puts "Self hosted: Fail syncs older than 2 hours"
execute <<-SQL
UPDATE syncs
SET status = 'failed'
WHERE (
status = 'syncing' AND
created_at < NOW() - INTERVAL '2 hours'
)
SQL
end
end end
dir.down do dir.down do

3
db/schema.rb generated
View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2025_05_14_143017) do ActiveRecord::Schema[7.2].define(version: 2025_05_13_122703) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto" enable_extension "pgcrypto"
enable_extension "plpgsql" enable_extension "plpgsql"
@ -696,7 +696,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_05_14_143017) do
t.text "goals", default: [], array: true t.text "goals", default: [], array: true
t.datetime "set_onboarding_preferences_at" t.datetime "set_onboarding_preferences_at"
t.datetime "set_onboarding_goals_at" t.datetime "set_onboarding_goals_at"
t.string "preferred_account_group_tab", default: "asset"
t.index ["email"], name: "index_users_on_email", unique: true t.index ["email"], name: "index_users_on_email", unique: true
t.index ["family_id"], name: "index_users_on_family_id" t.index ["family_id"], name: "index_users_on_family_id"
t.index ["last_viewed_chat_id"], name: "index_users_on_last_viewed_chat_id" t.index ["last_viewed_chat_id"], name: "index_users_on_last_viewed_chat_id"