mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 17:25:34 +08:00
See: https://meta.discourse.org/t/cakeday-plugin-disabled/389830 and the previous commits:3729361c32c02de976fcb10ea7929f
37 lines
1 KiB
Ruby
Vendored
37 lines
1 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
# Disabled due to invalid logic
|
|
class DeleteOldDefaultValues < ActiveRecord::Migration[8.0]
|
|
# def up
|
|
# delete_setting("cakeday_enabled", migration_timestamp("20250717093505"))
|
|
# delete_setting("cakeday_birthday_enabled", migration_timestamp("20250811132217"))
|
|
# end
|
|
|
|
# def down
|
|
# raise ActiveRecord::IrreversibleMigration
|
|
# end
|
|
|
|
# private
|
|
|
|
# def migration_timestamp(version)
|
|
# DB.query_single(<<~SQL, version:).first
|
|
# SELECT created_at
|
|
# FROM schema_migration_details
|
|
# WHERE version = :version
|
|
# SQL
|
|
# end
|
|
|
|
# def delete_setting(name, time)
|
|
# return if time.nil?
|
|
|
|
# DB.exec(<<~SQL, name:, time:)
|
|
# DELETE FROM site_settings
|
|
# WHERE
|
|
# name = :name AND
|
|
# created_at >= timestamp :time - interval '10 seconds' AND
|
|
# created_at <= timestamp :time + interval '10 seconds' AND
|
|
# updated_at >= timestamp :time - interval '10 seconds' AND
|
|
# updated_at <= timestamp :time + interval '10 seconds'
|
|
# SQL
|
|
# end
|
|
end
|