moved comments to the bottom, they are way less intrusive there

This commit is contained in:
Sam 2013-05-24 12:48:32 +10:00
parent 2cd95bc649
commit ca2dee52db
48 changed files with 748 additions and 706 deletions

View file

@ -6,6 +6,14 @@ GIT
rake
rake-compiler
GIT
remote: https://github.com/SamSaffron/annotate_models.git
revision: ebe4ba7e3f6ceeb43e4e40078da2b261a1bb71b2
specs:
annotate (2.6.0.beta1)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
GIT
remote: https://github.com/SamSaffron/message_bus
revision: 031a107bbe6e468caa67ff540485d70230d1c362
@ -71,13 +79,6 @@ GIT
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
PATH
remote: /home/sam/Source/annotate_models
specs:
annotate (2.6.0.beta1)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
PATH
remote: vendor/gems/discourse_emoji
specs:

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: admin_logs
#
# id :integer not null, primary key
# action :integer not null
# admin_id :integer not null
# target_user_id :integer
# details :text
# created_at :datetime not null
# updated_at :datetime not null
#
# AdminLog stores information about actions that admins and moderators have taken,
# like deleting users, changing site settings, etc.
# Use the AdminLogger class to log records to this table.
@ -27,3 +14,17 @@ class AdminLog < ActiveRecord::Base
@actions ||= Enum.new(:delete_user)
end
end
# == Schema Information
#
# Table name: admin_logs
#
# id :integer not null, primary key
# action :integer not null
# admin_id :integer not null
# target_user_id :integer
# details :text
# created_at :datetime not null
# updated_at :datetime not null
#

View file

@ -1,31 +1,3 @@
# == Schema Information
#
# Table name: categories
#
# id :integer not null, primary key
# name :string(50) not null
# color :string(6) default("AB9364"), not null
# topic_id :integer
# topic_count :integer default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
# topics_year :integer
# topics_month :integer
# topics_week :integer
# slug :string(255) not null
# description :text
# text_color :string(6) default("FFFFFF"), not null
# hotness :float default(5.0), not null
# secure :boolean default(FALSE), not null
# auto_close_days :float
#
# Indexes
#
# index_categories_on_forum_thread_count (topic_count)
# index_categories_on_name (name) UNIQUE
#
class Category < ActiveRecord::Base
belongs_to :topic, dependent: :destroy
belongs_to :topic_only_relative_url,
@ -164,3 +136,32 @@ class Category < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: categories
#
# id :integer not null, primary key
# name :string(50) not null
# color :string(6) default("AB9364"), not null
# topic_id :integer
# topic_count :integer default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
# topics_year :integer
# topics_month :integer
# topics_week :integer
# slug :string(255) not null
# description :text
# text_color :string(6) default("FFFFFF"), not null
# hotness :float default(5.0), not null
# secure :boolean default(FALSE), not null
# auto_close_days :float
#
# Indexes
#
# index_categories_on_forum_thread_count (topic_count)
# index_categories_on_name (name) UNIQUE
#

View file

@ -1,17 +1,3 @@
# == Schema Information
#
# Table name: category_featured_topics
#
# category_id :integer not null
# topic_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# cat_featured_threads (category_id,topic_id) UNIQUE
#
class CategoryFeaturedTopic < ActiveRecord::Base
belongs_to :category
belongs_to :topic
@ -50,3 +36,18 @@ class CategoryFeaturedTopic < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: category_featured_topics
#
# category_id :integer not null
# topic_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# cat_featured_threads (category_id,topic_id) UNIQUE
#

View file

@ -1,18 +1,3 @@
# == Schema Information
#
# Table name: category_featured_users
#
# id :integer not null, primary key
# category_id :integer
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_category_featured_users_on_category_id_and_user_id (category_id,user_id) UNIQUE
#
class CategoryFeaturedUser < ActiveRecord::Base
belongs_to :category
belongs_to :user
@ -44,3 +29,19 @@ class CategoryFeaturedUser < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: category_featured_users
#
# id :integer not null, primary key
# category_id :integer
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_category_featured_users_on_category_id_and_user_id (category_id,user_id) UNIQUE
#

View file

@ -1,3 +1,8 @@
class CategoryGroup < ActiveRecord::Base
belongs_to :category
belongs_to :group
end
# == Schema Information
#
# Table name: category_groups
@ -9,7 +14,3 @@
# updated_at :datetime not null
#
class CategoryGroup < ActiveRecord::Base
belongs_to :category
belongs_to :group
end

View file

@ -1,3 +1,9 @@
class CategorySearchData < ActiveRecord::Base
belongs_to :category
validates_presence_of :search_data
end
# == Schema Information
#
# Table name: category_search_data
@ -10,8 +16,3 @@
# idx_search_category (search_data)
#
class CategorySearchData < ActiveRecord::Base
belongs_to :category
validates_presence_of :search_data
end

View file

@ -1,20 +1,3 @@
# == Schema Information
#
# Table name: drafts
#
# id :integer not null, primary key
# user_id :integer not null
# draft_key :string(255) not null
# data :text not null
# created_at :datetime not null
# updated_at :datetime not null
# sequence :integer default(0), not null
#
# Indexes
#
# index_drafts_on_user_id_and_draft_key (user_id,draft_key)
#
class Draft < ActiveRecord::Base
NEW_TOPIC = 'new_topic'
NEW_PRIVATE_MESSAGE = 'new_private_message'
@ -54,3 +37,21 @@ class Draft < ActiveRecord::Base
Draft.where(user_id: user_id, draft_key: key).first
end
end
# == Schema Information
#
# Table name: drafts
#
# id :integer not null, primary key
# user_id :integer not null
# draft_key :string(255) not null
# data :text not null
# created_at :datetime not null
# updated_at :datetime not null
# sequence :integer default(0), not null
#
# Indexes
#
# index_drafts_on_user_id_and_draft_key (user_id,draft_key)
#

View file

@ -1,17 +1,3 @@
# == Schema Information
#
# Table name: draft_sequences
#
# id :integer not null, primary key
# user_id :integer not null
# draft_key :string(255) not null
# sequence :integer not null
#
# Indexes
#
# index_draft_sequences_on_user_id_and_draft_key (user_id,draft_key) UNIQUE
#
class DraftSequence < ActiveRecord::Base
def self.next!(user,key)
user_id = user
@ -37,3 +23,18 @@ class DraftSequence < ActiveRecord::Base
r.length.zero? ? 0 : r[0][0].to_i
end
end
# == Schema Information
#
# Table name: draft_sequences
#
# id :integer not null, primary key
# user_id :integer not null
# draft_key :string(255) not null
# sequence :integer not null
#
# Indexes
#
# index_draft_sequences_on_user_id_and_draft_key (user_id,draft_key) UNIQUE
#

View file

@ -1,3 +1,18 @@
class EmailLog < ActiveRecord::Base
belongs_to :user
validates_presence_of :email_type
validates_presence_of :to_address
after_create do
# Update last_emailed_at if the user_id is present
User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present?
end
def self.count_per_day(sinceDaysAgo = 30)
where('created_at > ?', sinceDaysAgo.days.ago).group('date(created_at)').order('date(created_at)').count
end
end
# == Schema Information
#
# Table name: email_logs
@ -15,17 +30,3 @@
# index_email_logs_on_user_id_and_created_at (user_id,created_at)
#
class EmailLog < ActiveRecord::Base
belongs_to :user
validates_presence_of :email_type
validates_presence_of :to_address
after_create do
# Update last_emailed_at if the user_id is present
User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present?
end
def self.count_per_day(sinceDaysAgo = 30)
where('created_at > ?', sinceDaysAgo.days.ago).group('date(created_at)').order('date(created_at)').count
end
end

View file

@ -1,21 +1,3 @@
# == Schema Information
#
# Table name: email_tokens
#
# id :integer not null, primary key
# user_id :integer not null
# email :string(255) not null
# token :string(255) not null
# confirmed :boolean default(FALSE), not null
# expired :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_email_tokens_on_token (token) UNIQUE
#
class EmailToken < ActiveRecord::Base
belongs_to :user
@ -76,3 +58,22 @@ class EmailToken < ActiveRecord::Base
# If the user's email is already taken, just return nil (failure)
end
end
# == Schema Information
#
# Table name: email_tokens
#
# id :integer not null, primary key
# user_id :integer not null
# email :string(255) not null
# token :string(255) not null
# confirmed :boolean default(FALSE), not null
# expired :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_email_tokens_on_token (token) UNIQUE
#

View file

@ -1,3 +1,8 @@
class FacebookUserInfo < ActiveRecord::Base
attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link
belongs_to :user
end
# == Schema Information
#
# Table name: facebook_user_infos
@ -21,7 +26,3 @@
# index_facebook_user_infos_on_user_id (user_id) UNIQUE
#
class FacebookUserInfo < ActiveRecord::Base
attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link
belongs_to :user
end

View file

@ -1,3 +1,7 @@
class GithubUserInfo < ActiveRecord::Base
belongs_to :user
end
# == Schema Information
#
# Table name: github_user_infos
@ -15,6 +19,3 @@
# index_github_user_infos_on_user_id (user_id) UNIQUE
#
class GithubUserInfo < ActiveRecord::Base
belongs_to :user
end

View file

@ -1,19 +1,3 @@
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# automatic :boolean default(FALSE), not null
# user_count :integer default(0), not null
#
# Indexes
#
# index_groups_on_name (name) UNIQUE
#
class Group < ActiveRecord::Base
has_many :category_groups
has_many :group_users, dependent: :destroy
@ -172,3 +156,20 @@ class Group < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# automatic :boolean default(FALSE), not null
# user_count :integer default(0), not null
#
# Indexes
#
# index_groups_on_name (name) UNIQUE
#

View file

@ -1,3 +1,8 @@
class GroupUser < ActiveRecord::Base
belongs_to :group, counter_cache: "user_count"
belongs_to :user
end
# == Schema Information
#
# Table name: group_users
@ -13,7 +18,3 @@
# index_group_users_on_group_id_and_user_id (group_id,user_id) UNIQUE
#
class GroupUser < ActiveRecord::Base
belongs_to :group, counter_cache: "user_count"
belongs_to :user
end

View file

@ -1,23 +1,3 @@
# == Schema Information
#
# Table name: hot_topics
#
# id :integer not null, primary key
# topic_id :integer not null
# category_id :integer
# score :float not null
# random_bias :float
# random_multiplier :float
# days_ago_bias :float
# days_ago_multiplier :float
# hot_topic_type :integer
#
# Indexes
#
# index_hot_topics_on_score (score)
# index_hot_topics_on_topic_id (topic_id) UNIQUE
#
class HotTopic < ActiveRecord::Base
belongs_to :topic
@ -144,3 +124,24 @@ class HotTopic < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: hot_topics
#
# id :integer not null, primary key
# topic_id :integer not null
# category_id :integer
# score :float not null
# random_bias :float
# random_multiplier :float
# days_ago_bias :float
# days_ago_multiplier :float
# hot_topic_type :integer
#
# Indexes
#
# index_hot_topics_on_score (score)
# index_hot_topics_on_topic_id (topic_id) UNIQUE
#

View file

@ -1,24 +1,3 @@
# == Schema Information
#
# Table name: incoming_links
#
# id :integer not null, primary key
# url :string(1000) not null
# referer :string(1000)
# domain :string(100)
# topic_id :integer
# post_number :integer
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# ip_address :string
# current_user_id :integer
#
# Indexes
#
# incoming_index (topic_id,post_number)
#
class IncomingLink < ActiveRecord::Base
belongs_to :topic
belongs_to :user
@ -107,3 +86,25 @@ class IncomingLink < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: incoming_links
#
# id :integer not null, primary key
# url :string(1000) not null
# referer :string(1000)
# domain :string(100)
# topic_id :integer
# post_number :integer
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# ip_address :string
# current_user_id :integer
#
# Indexes
#
# incoming_index (topic_id,post_number)
#

View file

@ -1,23 +1,3 @@
# == Schema Information
#
# Table name: invites
#
# id :integer not null, primary key
# invite_key :string(32) not null
# email :string(255) not null
# invited_by_id :integer not null
# user_id :integer
# redeemed_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# deleted_at :datetime
#
# Indexes
#
# index_invites_on_email_and_invited_by_id (email,invited_by_id) UNIQUE
# index_invites_on_invite_key (invite_key) UNIQUE
#
require_dependency 'trashable'
class Invite < ActiveRecord::Base
@ -105,3 +85,24 @@ class Invite < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: invites
#
# id :integer not null, primary key
# invite_key :string(32) not null
# email :string(255) not null
# invited_by_id :integer not null
# user_id :integer
# redeemed_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# deleted_at :datetime
#
# Indexes
#
# index_invites_on_email_and_invited_by_id (email,invited_by_id) UNIQUE
# index_invites_on_invite_key (invite_key) UNIQUE
#

View file

@ -1,24 +1,3 @@
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# notification_type :integer not null
# user_id :integer not null
# data :string(1000) not null
# read :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# topic_id :integer
# post_number :integer
# post_action_id :integer
#
# Indexes
#
# index_notifications_on_post_action_id (post_action_id)
# index_notifications_on_user_id_and_created_at (user_id,created_at)
#
require_dependency 'enum'
class Notification < ActiveRecord::Base
@ -124,3 +103,24 @@ class Notification < ActiveRecord::Base
end
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# notification_type :integer not null
# user_id :integer not null
# data :string(1000) not null
# read :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# topic_id :integer
# post_number :integer
# post_action_id :integer
#
# Indexes
#
# index_notifications_on_post_action_id (post_action_id)
# index_notifications_on_user_id_and_created_at (user_id,created_at)
#

View file

@ -1,50 +1,3 @@
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# user_id :integer not null
# topic_id :integer not null
# post_number :integer not null
# raw :text not null
# cooked :text not null
# created_at :datetime not null
# updated_at :datetime not null
# reply_to_post_number :integer
# cached_version :integer default(1), not null
# reply_count :integer default(0), not null
# quote_count :integer default(0), not null
# deleted_at :datetime
# off_topic_count :integer default(0), not null
# like_count :integer default(0), not null
# incoming_link_count :integer default(0), not null
# bookmark_count :integer default(0), not null
# avg_time :integer
# score :float
# reads :integer default(0), not null
# post_type :integer default(1), not null
# vote_count :integer default(0), not null
# sort_order :integer
# last_editor_id :integer
# hidden :boolean default(FALSE), not null
# hidden_reason_id :integer
# notify_moderators_count :integer default(0), not null
# spam_count :integer default(0), not null
# illegal_count :integer default(0), not null
# inappropriate_count :integer default(0), not null
# last_version_at :datetime not null
# user_deleted :boolean default(FALSE), not null
# reply_to_user_id :integer
# percent_rank :float default(1.0)
# notify_user_count :integer default(0), not null
#
# Indexes
#
# idx_posts_user_id_deleted_at (user_id)
# index_posts_on_reply_to_post_number (reply_to_post_number)
# index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE
#
require_dependency 'jobs'
require_dependency 'pretty_text'
require_dependency 'rate_limiter'
@ -536,3 +489,51 @@ class Post < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# user_id :integer not null
# topic_id :integer not null
# post_number :integer not null
# raw :text not null
# cooked :text not null
# created_at :datetime not null
# updated_at :datetime not null
# reply_to_post_number :integer
# cached_version :integer default(1), not null
# reply_count :integer default(0), not null
# quote_count :integer default(0), not null
# deleted_at :datetime
# off_topic_count :integer default(0), not null
# like_count :integer default(0), not null
# incoming_link_count :integer default(0), not null
# bookmark_count :integer default(0), not null
# avg_time :integer
# score :float
# reads :integer default(0), not null
# post_type :integer default(1), not null
# vote_count :integer default(0), not null
# sort_order :integer
# last_editor_id :integer
# hidden :boolean default(FALSE), not null
# hidden_reason_id :integer
# notify_moderators_count :integer default(0), not null
# spam_count :integer default(0), not null
# illegal_count :integer default(0), not null
# inappropriate_count :integer default(0), not null
# last_version_at :datetime not null
# user_deleted :boolean default(FALSE), not null
# reply_to_user_id :integer
# percent_rank :float default(1.0)
# notify_user_count :integer default(0), not null
#
# Indexes
#
# idx_posts_user_id_deleted_at (user_id)
# index_posts_on_reply_to_post_number (reply_to_post_number)
# index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE
#

View file

@ -1,24 +1,3 @@
# == Schema Information
#
# Table name: post_actions
#
# id :integer not null, primary key
# post_id :integer not null
# user_id :integer not null
# post_action_type_id :integer not null
# deleted_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# deleted_by :integer
# message :text
# related_post_id :integer
#
# Indexes
#
# idx_unique_actions (user_id,post_action_type_id,post_id,deleted_at) UNIQUE
# index_post_actions_on_post_id (post_id)
#
require_dependency 'rate_limiter'
require_dependency 'system_message'
require_dependency 'trashable'
@ -263,3 +242,25 @@ class PostAction < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: post_actions
#
# id :integer not null, primary key
# post_id :integer not null
# user_id :integer not null
# post_action_type_id :integer not null
# deleted_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# deleted_by :integer
# message :text
# related_post_id :integer
#
# Indexes
#
# idx_unique_actions (user_id,post_action_type_id,post_id,deleted_at) UNIQUE
# index_post_actions_on_post_id (post_id)
#

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: post_action_types
#
# name_key :string(50) not null
# is_flag :boolean default(FALSE), not null
# icon :string(20)
# created_at :datetime not null
# updated_at :datetime not null
# id :integer not null, primary key
# position :integer default(0), not null
#
require_dependency 'enum'
class PostActionType < ActiveRecord::Base
@ -44,3 +31,17 @@ class PostActionType < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: post_action_types
#
# name_key :string(50) not null
# is_flag :boolean default(FALSE), not null
# icon :string(20)
# created_at :datetime not null
# updated_at :datetime not null
# id :integer not null, primary key
# position :integer default(0), not null
#

View file

@ -1,3 +1,10 @@
class PostReply < ActiveRecord::Base
belongs_to :post
belongs_to :reply, class_name: 'Post'
validates_uniqueness_of :reply_id, scope: :post_id
end
# == Schema Information
#
# Table name: post_replies
@ -12,9 +19,3 @@
# index_post_replies_on_post_id_and_reply_id (post_id,reply_id) UNIQUE
#
class PostReply < ActiveRecord::Base
belongs_to :post
belongs_to :reply, class_name: 'Post'
validates_uniqueness_of :reply_id, scope: :post_id
end

View file

@ -1,3 +1,9 @@
class PostSearchData < ActiveRecord::Base
belongs_to :post
validates_presence_of :search_data
end
# == Schema Information
#
# Table name: post_search_data
@ -10,8 +16,3 @@
# idx_search_post (search_data)
#
class PostSearchData < ActiveRecord::Base
belongs_to :post
validates_presence_of :search_data
end

View file

@ -1,18 +1,3 @@
# == Schema Information
#
# Table name: post_timings
#
# topic_id :integer not null
# post_number :integer not null
# user_id :integer not null
# msecs :integer not null
#
# Indexes
#
# post_timings_summary (topic_id,post_number)
# post_timings_unique (topic_id,post_number,user_id) UNIQUE
#
class PostTiming < ActiveRecord::Base
belongs_to :topic
belongs_to :user
@ -81,3 +66,19 @@ class PostTiming < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: post_timings
#
# topic_id :integer not null
# post_number :integer not null
# user_id :integer not null
# msecs :integer not null
#
# Indexes
#
# post_timings_summary (topic_id,post_number)
# post_timings_unique (topic_id,post_number,user_id) UNIQUE
#

View file

@ -1,17 +1,3 @@
# == Schema Information
#
# Table name: site_contents
#
# content_type :string(255) not null, primary key
# content :text not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_site_contents_on_content_type (content_type) UNIQUE
#
require_dependency 'site_content_type'
require_dependency 'site_content_class_methods'
@ -37,3 +23,18 @@ class SiteContent < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: site_contents
#
# content_type :string(255) not null, primary key
# content :text not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_site_contents_on_content_type (content_type) UNIQUE
#

View file

@ -1,25 +1,3 @@
# == Schema Information
#
# Table name: site_customizations
#
# id :integer not null, primary key
# name :string(255) not null
# stylesheet :text
# header :text
# position :integer not null
# user_id :integer not null
# enabled :boolean not null
# key :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# override_default_style :boolean default(FALSE), not null
# stylesheet_baked :text default(""), not null
#
# Indexes
#
# index_site_customizations_on_key (key)
#
class SiteCustomization < ActiveRecord::Base
ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd'
# placing this in uploads to ease deployment rules
@ -191,3 +169,26 @@ footer:after{ content: '#{error}' }"
@stylesheet_link_tag = "<link class=\"custom-css\" rel=\"stylesheet\" href=\"/#{CACHE_PATH}#{stylesheet_filename}?#{stylesheet_hash}\" type=\"text/css\" media=\"screen\">"
end
end
# == Schema Information
#
# Table name: site_customizations
#
# id :integer not null, primary key
# name :string(255) not null
# stylesheet :text
# header :text
# position :integer not null
# user_id :integer not null
# enabled :boolean not null
# key :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# override_default_style :boolean default(FALSE), not null
# stylesheet_baked :text default(""), not null
#
# Indexes
#
# index_site_customizations_on_key (key)
#

View file

@ -1,15 +1,3 @@
# == Schema Information
#
# Table name: site_settings
#
# id :integer not null, primary key
# name :string(255) not null
# data_type :integer not null
# value :text
# created_at :datetime not null
# updated_at :datetime not null
#
require 'site_setting_extension'
class SiteSetting < ActiveRecord::Base
@ -238,3 +226,16 @@ class SiteSetting < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: site_settings
#
# id :integer not null, primary key
# name :string(255) not null
# data_type :integer not null
# value :text
# created_at :datetime not null
# updated_at :datetime not null
#

View file

@ -1,59 +1,3 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# title :string(255) not null
# last_posted_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# views :integer default(0), not null
# posts_count :integer default(0), not null
# user_id :integer not null
# last_post_user_id :integer not null
# reply_count :integer default(0), not null
# featured_user1_id :integer
# featured_user2_id :integer
# featured_user3_id :integer
# avg_time :integer
# deleted_at :datetime
# highest_post_number :integer default(0), not null
# image_url :string(255)
# off_topic_count :integer default(0), not null
# like_count :integer default(0), not null
# incoming_link_count :integer default(0), not null
# bookmark_count :integer default(0), not null
# star_count :integer default(0), not null
# category_id :integer
# visible :boolean default(TRUE), not null
# moderator_posts_count :integer default(0), not null
# closed :boolean default(FALSE), not null
# archived :boolean default(FALSE), not null
# bumped_at :datetime not null
# has_best_of :boolean default(FALSE), not null
# meta_data :hstore
# vote_count :integer default(0), not null
# archetype :string(255) default("regular"), not null
# featured_user4_id :integer
# notify_moderators_count :integer default(0), not null
# spam_count :integer default(0), not null
# illegal_count :integer default(0), not null
# inappropriate_count :integer default(0), not null
# pinned_at :datetime
# score :float
# percent_rank :float default(1.0), not null
# notify_user_count :integer default(0), not null
# subtype :string(255)
# slug :string(255)
# auto_close_at :datetime
# auto_close_user_id :integer
#
# Indexes
#
# idx_topics_user_id_deleted_at (user_id)
# index_forum_threads_on_bumped_at (bumped_at)
#
require_dependency 'slug'
require_dependency 'avatar_lookup'
require_dependency 'topic_view'
@ -785,3 +729,60 @@ class Topic < ActiveRecord::Base
category && category.secure
end
end
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# title :string(255) not null
# last_posted_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# views :integer default(0), not null
# posts_count :integer default(0), not null
# user_id :integer not null
# last_post_user_id :integer not null
# reply_count :integer default(0), not null
# featured_user1_id :integer
# featured_user2_id :integer
# featured_user3_id :integer
# avg_time :integer
# deleted_at :datetime
# highest_post_number :integer default(0), not null
# image_url :string(255)
# off_topic_count :integer default(0), not null
# like_count :integer default(0), not null
# incoming_link_count :integer default(0), not null
# bookmark_count :integer default(0), not null
# star_count :integer default(0), not null
# category_id :integer
# visible :boolean default(TRUE), not null
# moderator_posts_count :integer default(0), not null
# closed :boolean default(FALSE), not null
# archived :boolean default(FALSE), not null
# bumped_at :datetime not null
# has_best_of :boolean default(FALSE), not null
# meta_data :hstore
# vote_count :integer default(0), not null
# archetype :string(255) default("regular"), not null
# featured_user4_id :integer
# notify_moderators_count :integer default(0), not null
# spam_count :integer default(0), not null
# illegal_count :integer default(0), not null
# inappropriate_count :integer default(0), not null
# pinned_at :datetime
# score :float
# percent_rank :float default(1.0), not null
# notify_user_count :integer default(0), not null
# subtype :string(255)
# slug :string(255)
# auto_close_at :datetime
# auto_close_user_id :integer
#
# Indexes
#
# idx_topics_user_id_deleted_at (user_id)
# index_forum_threads_on_bumped_at (bumped_at)
#

View file

@ -1,3 +1,11 @@
class TopicAllowedGroup < ActiveRecord::Base
belongs_to :topic
belongs_to :group
attr_accessible :group_id, :user_id
validates_uniqueness_of :topic_id, scope: :group_id
end
# == Schema Information
#
# Table name: topic_allowed_groups
@ -12,10 +20,3 @@
# index_topic_allowed_groups_on_topic_id_and_group_id (topic_id,group_id) UNIQUE
#
class TopicAllowedGroup < ActiveRecord::Base
belongs_to :topic
belongs_to :group
attr_accessible :group_id, :user_id
validates_uniqueness_of :topic_id, scope: :group_id
end

View file

@ -1,3 +1,11 @@
class TopicAllowedUser < ActiveRecord::Base
belongs_to :topic
belongs_to :user
attr_accessible :topic_id, :user_id
validates_uniqueness_of :topic_id, scope: :user_id
end
# == Schema Information
#
# Table name: topic_allowed_users
@ -14,10 +22,3 @@
# index_topic_allowed_users_on_user_id_and_topic_id (user_id,topic_id) UNIQUE
#
class TopicAllowedUser < ActiveRecord::Base
belongs_to :topic
belongs_to :user
attr_accessible :topic_id, :user_id
validates_uniqueness_of :topic_id, scope: :user_id
end

View file

@ -1,3 +1,13 @@
class TopicInvite < ActiveRecord::Base
belongs_to :topic
belongs_to :invite
validates_presence_of :topic_id
validates_presence_of :invite_id
validates_uniqueness_of :topic_id, scope: :invite_id
end
# == Schema Information
#
# Table name: topic_invites
@ -14,12 +24,3 @@
# index_topic_invites_on_topic_id_and_invite_id (topic_id,invite_id) UNIQUE
#
class TopicInvite < ActiveRecord::Base
belongs_to :topic
belongs_to :invite
validates_presence_of :topic_id
validates_presence_of :invite_id
validates_uniqueness_of :topic_id, scope: :invite_id
end

View file

@ -1,27 +1,3 @@
# == Schema Information
#
# Table name: topic_links
#
# id :integer not null, primary key
# topic_id :integer not null
# post_id :integer
# user_id :integer not null
# url :string(500) not null
# domain :string(100) not null
# internal :boolean default(FALSE), not null
# link_topic_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# reflection :boolean default(FALSE)
# clicks :integer default(0), not null
# link_post_id :integer
#
# Indexes
#
# index_forum_thread_links_on_forum_thread_id (topic_id)
# index_forum_thread_links_on_forum_thread_id_and_post_id_and_url (topic_id,post_id,url) UNIQUE
#
require 'uri'
require_dependency 'slug'
@ -144,3 +120,28 @@ class TopicLink < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: topic_links
#
# id :integer not null, primary key
# topic_id :integer not null
# post_id :integer
# user_id :integer not null
# url :string(500) not null
# domain :string(100) not null
# internal :boolean default(FALSE), not null
# link_topic_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# reflection :boolean default(FALSE)
# clicks :integer default(0), not null
# link_post_id :integer
#
# Indexes
#
# index_forum_thread_links_on_forum_thread_id (topic_id)
# index_forum_thread_links_on_forum_thread_id_and_post_id_and_url (topic_id,post_id,url) UNIQUE
#

View file

@ -1,19 +1,3 @@
# == Schema Information
#
# Table name: topic_link_clicks
#
# id :integer not null, primary key
# topic_link_id :integer not null
# user_id :integer
# ip :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id)
#
require_dependency 'discourse'
require 'ipaddr'
@ -70,3 +54,20 @@ class TopicLinkClick < ActiveRecord::Base
result
end
end
# == Schema Information
#
# Table name: topic_link_clicks
#
# id :integer not null, primary key
# topic_link_id :integer not null
# user_id :integer
# ip :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id)
#

View file

@ -1,28 +1,3 @@
# == Schema Information
#
# Table name: topic_users
#
# user_id :integer not null
# topic_id :integer not null
# starred :boolean default(FALSE), not null
# posted :boolean default(FALSE), not null
# last_read_post_number :integer
# seen_post_count :integer
# starred_at :datetime
# last_visited_at :datetime
# first_visited_at :datetime
# notification_level :integer default(1), not null
# notifications_changed_at :datetime
# notifications_reason_id :integer
# total_msecs_viewed :integer default(0), not null
# cleared_pinned_at :datetime
# unstarred_at :datetime
#
# Indexes
#
# index_forum_thread_users_on_forum_thread_id_and_user_id (topic_id,user_id) UNIQUE
#
class TopicUser < ActiveRecord::Base
belongs_to :user
belongs_to :topic
@ -234,3 +209,29 @@ SQL
end
end
# == Schema Information
#
# Table name: topic_users
#
# user_id :integer not null
# topic_id :integer not null
# starred :boolean default(FALSE), not null
# posted :boolean default(FALSE), not null
# last_read_post_number :integer
# seen_post_count :integer
# starred_at :datetime
# last_visited_at :datetime
# first_visited_at :datetime
# notification_level :integer default(1), not null
# notifications_changed_at :datetime
# notifications_reason_id :integer
# total_msecs_viewed :integer default(0), not null
# cleared_pinned_at :datetime
# unstarred_at :datetime
#
# Indexes
#
# index_forum_thread_users_on_forum_thread_id_and_user_id (topic_id,user_id) UNIQUE
#

View file

@ -1,3 +1,7 @@
class TwitterUserInfo < ActiveRecord::Base
belongs_to :user
end
# == Schema Information
#
# Table name: twitter_user_infos
@ -15,6 +19,3 @@
# index_twitter_user_infos_on_user_id (user_id) UNIQUE
#
class TwitterUserInfo < ActiveRecord::Base
belongs_to :user
end

View file

@ -1,24 +1,3 @@
# == Schema Information
#
# Table name: uploads
#
# id :integer not null, primary key
# user_id :integer not null
# topic_id :integer not null
# original_filename :string(255) not null
# filesize :integer not null
# width :integer
# height :integer
# url :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_uploads_on_forum_thread_id (topic_id)
# index_uploads_on_user_id (user_id)
#
require 'digest/sha1'
class Upload < ActiveRecord::Base
@ -114,3 +93,25 @@ class Upload < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: uploads
#
# id :integer not null, primary key
# user_id :integer not null
# topic_id :integer not null
# original_filename :string(255) not null
# filesize :integer not null
# width :integer
# height :integer
# url :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_uploads_on_forum_thread_id (topic_id)
# index_uploads_on_user_id (user_id)
#

View file

@ -1,63 +1,3 @@
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string(20) not null
# created_at :datetime not null
# updated_at :datetime not null
# name :string(255)
# bio_raw :text
# seen_notification_id :integer default(0), not null
# last_posted_at :datetime
# email :string(256) not null
# password_hash :string(64)
# salt :string(32)
# active :boolean
# username_lower :string(20) not null
# auth_token :string(32)
# last_seen_at :datetime
# website :string(255)
# admin :boolean default(FALSE), not null
# last_emailed_at :datetime
# email_digests :boolean default(TRUE), not null
# trust_level :integer not null
# bio_cooked :text
# email_private_messages :boolean default(TRUE)
# email_direct :boolean default(TRUE), not null
# approved :boolean default(FALSE), not null
# approved_by_id :integer
# approved_at :datetime
# topics_entered :integer default(0), not null
# posts_read_count :integer default(0), not null
# digest_after_days :integer default(7), not null
# previous_visit_at :datetime
# banned_at :datetime
# banned_till :datetime
# date_of_birth :date
# auto_track_topics_after_msecs :integer
# views :integer default(0), not null
# flag_level :integer default(0), not null
# time_read :integer default(0), not null
# days_visited :integer default(0), not null
# ip_address :string
# new_topic_duration_minutes :integer
# external_links_in_new_tab :boolean default(FALSE), not null
# enable_quoting :boolean default(TRUE), not null
# moderator :boolean default(FALSE)
# likes_given :integer default(0), not null
# likes_received :integer default(0), not null
# topic_reply_count :integer default(0), not null
#
# Indexes
#
# index_users_on_auth_token (auth_token)
# index_users_on_email (email) UNIQUE
# index_users_on_last_posted_at (last_posted_at)
# index_users_on_username (username) UNIQUE
# index_users_on_username_lower (username_lower) UNIQUE
#
require_dependency 'email'
require_dependency 'email_token'
require_dependency 'trust_level'
@ -718,3 +658,64 @@ class User < ActiveRecord::Base
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string(20) not null
# created_at :datetime not null
# updated_at :datetime not null
# name :string(255)
# bio_raw :text
# seen_notification_id :integer default(0), not null
# last_posted_at :datetime
# email :string(256) not null
# password_hash :string(64)
# salt :string(32)
# active :boolean
# username_lower :string(20) not null
# auth_token :string(32)
# last_seen_at :datetime
# website :string(255)
# admin :boolean default(FALSE), not null
# last_emailed_at :datetime
# email_digests :boolean default(TRUE), not null
# trust_level :integer not null
# bio_cooked :text
# email_private_messages :boolean default(TRUE)
# email_direct :boolean default(TRUE), not null
# approved :boolean default(FALSE), not null
# approved_by_id :integer
# approved_at :datetime
# topics_entered :integer default(0), not null
# posts_read_count :integer default(0), not null
# digest_after_days :integer default(7), not null
# previous_visit_at :datetime
# banned_at :datetime
# banned_till :datetime
# date_of_birth :date
# auto_track_topics_after_msecs :integer
# views :integer default(0), not null
# flag_level :integer default(0), not null
# time_read :integer default(0), not null
# days_visited :integer default(0), not null
# ip_address :string
# new_topic_duration_minutes :integer
# external_links_in_new_tab :boolean default(FALSE), not null
# enable_quoting :boolean default(TRUE), not null
# moderator :boolean default(FALSE)
# likes_given :integer default(0), not null
# likes_received :integer default(0), not null
# topic_reply_count :integer default(0), not null
#
# Indexes
#
# index_users_on_auth_token (auth_token)
# index_users_on_email (email) UNIQUE
# index_users_on_last_posted_at (last_posted_at)
# index_users_on_username (username) UNIQUE
# index_users_on_username_lower (username_lower) UNIQUE
#

View file

@ -1,24 +1,3 @@
# == Schema Information
#
# Table name: user_actions
#
# id :integer not null, primary key
# action_type :integer not null
# user_id :integer not null
# target_topic_id :integer
# target_post_id :integer
# target_user_id :integer
# acting_user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE
# index_actions_on_acting_user_id (acting_user_id)
# index_actions_on_user_id_and_action_type (user_id,action_type)
#
class UserAction < ActiveRecord::Base
belongs_to :user
belongs_to :target_post, class_name: "Post"
@ -292,3 +271,25 @@ ORDER BY p.created_at desc
end
end
end
# == Schema Information
#
# Table name: user_actions
#
# id :integer not null, primary key
# action_type :integer not null
# user_id :integer not null
# target_topic_id :integer
# target_post_id :integer
# target_user_id :integer
# acting_user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE
# index_actions_on_acting_user_id (acting_user_id)
# index_actions_on_user_id_and_action_type (user_id,action_type)
#

View file

@ -1,3 +1,11 @@
class UserOpenId < ActiveRecord::Base
belongs_to :user
attr_accessible :email, :url, :user_id, :active
validates_presence_of :email
validates_presence_of :url
end
# == Schema Information
#
# Table name: user_open_ids
@ -15,10 +23,3 @@
# index_user_open_ids_on_url (url)
#
class UserOpenId < ActiveRecord::Base
belongs_to :user
attr_accessible :email, :url, :user_id, :active
validates_presence_of :email
validates_presence_of :url
end

View file

@ -1,3 +1,8 @@
class UserSearchData < ActiveRecord::Base
belongs_to :user
validates_presence_of :search_data
end
# == Schema Information
#
# Table name: user_search_data
@ -10,7 +15,3 @@
# idx_search_user (search_data)
#
class UserSearchData < ActiveRecord::Base
belongs_to :user
validates_presence_of :search_data
end

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: user_visits
#
# id :integer not null, primary key
# user_id :integer not null
# visited_at :date not null
#
# Indexes
#
# index_user_visits_on_user_id_and_visited_at (user_id,visited_at) UNIQUE
#
class UserVisit < ActiveRecord::Base
attr_accessible :visited_at, :user_id
@ -32,3 +19,17 @@ class UserVisit < ActiveRecord::Base
SQL
end
end
# == Schema Information
#
# Table name: user_visits
#
# id :integer not null, primary key
# user_id :integer not null
# visited_at :date not null
#
# Indexes
#
# index_user_visits_on_user_id_and_visited_at (user_id,visited_at) UNIQUE
#

View file

@ -1,18 +1,3 @@
# == Schema Information
#
# Table name: views
#
# parent_id :integer not null
# parent_type :string(50) not null
# ip :integer not null
# viewed_at :date not null
# user_id :integer
#
# Indexes
#
# index_views_on_parent_id_and_parent_type (parent_id,parent_type)
#
require 'ipaddr'
class View < ActiveRecord::Base
@ -45,3 +30,19 @@ class View < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: views
#
# parent_id :integer not null
# parent_type :string(50) not null
# ip :integer not null
# viewed_at :date not null
# user_id :integer
#
# Indexes
#
# index_views_on_parent_id_and_parent_type (parent_id,parent_type)
#

View file

@ -7,7 +7,7 @@ if(Rails.env.development?)
# same name.
Annotate.set_defaults({
'position_in_routes' => "before",
'position_in_class' => "before",
'position_in_class' => "after",
'position_in_test' => "before",
'position_in_fixture' => "before",
'position_in_factory' => "before",

View file

@ -2,4 +2,4 @@ Fabricator(:email_log,) do
user
to_address { sequence(:address) { |i| "blah#{i}@example.com" } }
email_type :invite
end
end

View file

@ -1,4 +1,4 @@
Fabricator(:invite) do
invited_by(fabricator: :user)
email 'iceking@ADVENTURETIME.ooo'
end
end

View file

@ -11,4 +11,4 @@ end
Fabricator(:site_content_site_setting, from: :site_content) do
content_type 'site.replacement'
content "%{title} is evil."
end
end

View file

@ -5,4 +5,4 @@ describe UserOpenId do
it { should belong_to :user }
it { should validate_presence_of :email }
it { should validate_presence_of :url }
end
end