mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add a Staff category. Have a topic for assets in the Staff category. Move admin quick start guide to Staff category. Quick start guide is not invisible anymore.
This commit is contained in:
25
db/migrate/20140227201005_add_staff_category.rb
Normal file
25
db/migrate/20140227201005_add_staff_category.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class AddStaffCategory < ActiveRecord::Migration
|
||||
def up
|
||||
unless Rails.env.test?
|
||||
result = Category.exec_sql "SELECT 1 FROM site_settings where name = 'staff_category_id'"
|
||||
if result.count == 0
|
||||
description = I18n.t('staff_category_description')
|
||||
name = I18n.t('staff_category_name')
|
||||
if Category.exec_sql("SELECT 1 FROM categories where name ilike '#{name}'").count == 0
|
||||
result = execute "INSERT INTO categories
|
||||
(name, color, text_color, created_at, updated_at, user_id, slug, description, read_restricted)
|
||||
VALUES ('#{name}', '283890', 'FFFFFF', now(), now(), -1, '#{Slug.for(name)}', '#{description}', true)
|
||||
RETURNING id"
|
||||
category_id = result[0]["id"].to_i
|
||||
|
||||
execute "INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||
VALUES ('staff_category_id', 3, #{category_id}, now(), now())"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# Do nothing
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user