mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: enable tagging by default (#13175)
Over the years we have found that a few communities never discovered tags. Instead of having them default off we now have them default on, ensuring that everyone finds out about them. Co-authored-by: Dan Ungureanu <dan@ungureanu.me>
This commit is contained in:
25
db/migrate/20210527114834_set_tagging_enabled.rb
Normal file
25
db/migrate/20210527114834_set_tagging_enabled.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SetTaggingEnabled < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
result = execute <<~SQL
|
||||
SELECT created_at
|
||||
FROM schema_migration_details
|
||||
ORDER BY created_at
|
||||
LIMIT 1
|
||||
SQL
|
||||
|
||||
# keep tagging disabled for existing sites
|
||||
if result.first['created_at'].to_datetime < 1.hour.ago
|
||||
execute <<~SQL
|
||||
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||
VALUES('tagging_enabled', 5, 'f', NOW(), NOW())
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user