lets try out annotations

This commit is contained in:
Sam 2013-05-24 12:35:14 +10:00
parent dd1ad508cf
commit 2cd95bc649
45 changed files with 870 additions and 1 deletions

View File

@ -116,6 +116,8 @@ group :development do
gem 'binding_of_caller' gem 'binding_of_caller'
gem 'librarian', '>= 0.0.25', require: false gem 'librarian', '>= 0.0.25', require: false
gem 'pry-rails' gem 'pry-rails'
# https://github.com/ctran/annotate_models/pull/106
gem 'annotate', :git => 'https://github.com/SamSaffron/annotate_models.git'
end end
# we are using a custom sprockets repo to work around: https://github.com/rails/rails/issues/8099#issuecomment-16137638 # we are using a custom sprockets repo to work around: https://github.com/rails/rails/issues/8099#issuecomment-16137638

View File

@ -71,6 +71,13 @@ GIT
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
activesupport (>= 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 PATH
remote: vendor/gems/discourse_emoji remote: vendor/gems/discourse_emoji
specs: specs:
@ -458,6 +465,7 @@ DEPENDENCIES
active_model_serializers! active_model_serializers!
activerecord-postgres-hstore activerecord-postgres-hstore
airbrake (= 3.1.2) airbrake (= 3.1.2)
annotate!
barber (= 0.3.0) barber (= 0.3.0)
better_errors better_errors
binding_of_caller binding_of_caller

View File

@ -1,3 +1,16 @@
# == 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, # AdminLog stores information about actions that admins and moderators have taken,
# like deleting users, changing site settings, etc. # like deleting users, changing site settings, etc.
# Use the AdminLogger class to log records to this table. # Use the AdminLogger class to log records to this table.

View File

@ -1,3 +1,31 @@
# == 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 class Category < ActiveRecord::Base
belongs_to :topic, dependent: :destroy belongs_to :topic, dependent: :destroy
belongs_to :topic_only_relative_url, belongs_to :topic_only_relative_url,

View File

@ -1,3 +1,17 @@
# == 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 class CategoryFeaturedTopic < ActiveRecord::Base
belongs_to :category belongs_to :category
belongs_to :topic belongs_to :topic

View File

@ -1,3 +1,18 @@
# == 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 class CategoryFeaturedUser < ActiveRecord::Base
belongs_to :category belongs_to :category
belongs_to :user belongs_to :user

View File

@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: category_groups
#
# id :integer not null, primary key
# category_id :integer not null
# group_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class CategoryGroup < ActiveRecord::Base class CategoryGroup < ActiveRecord::Base
belongs_to :category belongs_to :category
belongs_to :group belongs_to :group

View File

@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: category_search_data
#
# category_id :integer not null, primary key
# search_data :tsvector
#
# Indexes
#
# idx_search_category (search_data)
#
class CategorySearchData < ActiveRecord::Base class CategorySearchData < ActiveRecord::Base
belongs_to :category belongs_to :category

View File

@ -1,3 +1,20 @@
# == 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 class Draft < ActiveRecord::Base
NEW_TOPIC = 'new_topic' NEW_TOPIC = 'new_topic'
NEW_PRIVATE_MESSAGE = 'new_private_message' NEW_PRIVATE_MESSAGE = 'new_private_message'

View File

@ -1,3 +1,17 @@
# == 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 class DraftSequence < ActiveRecord::Base
def self.next!(user,key) def self.next!(user,key)
user_id = user user_id = user

View File

@ -1,3 +1,20 @@
# == Schema Information
#
# Table name: email_logs
#
# id :integer not null, primary key
# to_address :string(255) not null
# email_type :string(255) not null
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_email_logs_on_created_at (created_at)
# index_email_logs_on_user_id_and_created_at (user_id,created_at)
#
class EmailLog < ActiveRecord::Base class EmailLog < ActiveRecord::Base
belongs_to :user belongs_to :user
validates_presence_of :email_type validates_presence_of :email_type

View File

@ -1,3 +1,21 @@
# == 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 class EmailToken < ActiveRecord::Base
belongs_to :user belongs_to :user

View File

@ -1,3 +1,26 @@
# == Schema Information
#
# Table name: facebook_user_infos
#
# id :integer not null, primary key
# user_id :integer not null
# facebook_user_id :integer not null
# username :string(255) not null
# first_name :string(255)
# last_name :string(255)
# email :string(255)
# gender :string(255)
# name :string(255)
# link :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_facebook_user_infos_on_facebook_user_id (facebook_user_id) UNIQUE
# index_facebook_user_infos_on_user_id (user_id) UNIQUE
#
class FacebookUserInfo < ActiveRecord::Base class FacebookUserInfo < ActiveRecord::Base
attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link
belongs_to :user belongs_to :user

View File

@ -1,3 +1,20 @@
# == Schema Information
#
# Table name: github_user_infos
#
# id :integer not null, primary key
# user_id :integer not null
# screen_name :string(255) not null
# github_user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_github_user_infos_on_github_user_id (github_user_id) UNIQUE
# index_github_user_infos_on_user_id (user_id) UNIQUE
#
class GithubUserInfo < ActiveRecord::Base class GithubUserInfo < ActiveRecord::Base
belongs_to :user belongs_to :user
end end

View File

@ -1,3 +1,19 @@
# == 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 class Group < ActiveRecord::Base
has_many :category_groups has_many :category_groups
has_many :group_users, dependent: :destroy has_many :group_users, dependent: :destroy

View File

@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: group_users
#
# id :integer not null, primary key
# group_id :integer not null
# user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_group_users_on_group_id_and_user_id (group_id,user_id) UNIQUE
#
class GroupUser < ActiveRecord::Base class GroupUser < ActiveRecord::Base
belongs_to :group, counter_cache: "user_count" belongs_to :group, counter_cache: "user_count"
belongs_to :user belongs_to :user

View File

@ -1,3 +1,23 @@
# == 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 class HotTopic < ActiveRecord::Base
belongs_to :topic belongs_to :topic

View File

@ -1,3 +1,24 @@
# == 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 class IncomingLink < ActiveRecord::Base
belongs_to :topic belongs_to :topic
belongs_to :user belongs_to :user

View File

@ -1,3 +1,23 @@
# == 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' require_dependency 'trashable'
class Invite < ActiveRecord::Base class Invite < ActiveRecord::Base

View File

@ -1,3 +1,24 @@
# == 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' require_dependency 'enum'
class Notification < ActiveRecord::Base class Notification < ActiveRecord::Base

View File

@ -1,3 +1,50 @@
# == 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 'jobs'
require_dependency 'pretty_text' require_dependency 'pretty_text'
require_dependency 'rate_limiter' require_dependency 'rate_limiter'

View File

@ -1,3 +1,24 @@
# == 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 'rate_limiter'
require_dependency 'system_message' require_dependency 'system_message'
require_dependency 'trashable' require_dependency 'trashable'

View File

@ -1,3 +1,16 @@
# == 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' require_dependency 'enum'
class PostActionType < ActiveRecord::Base class PostActionType < ActiveRecord::Base

View File

@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: post_replies
#
# post_id :integer
# reply_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_post_replies_on_post_id_and_reply_id (post_id,reply_id) UNIQUE
#
class PostReply < ActiveRecord::Base class PostReply < ActiveRecord::Base
belongs_to :post belongs_to :post
belongs_to :reply, class_name: 'Post' belongs_to :reply, class_name: 'Post'

View File

@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: post_search_data
#
# post_id :integer not null, primary key
# search_data :tsvector
#
# Indexes
#
# idx_search_post (search_data)
#
class PostSearchData < ActiveRecord::Base class PostSearchData < ActiveRecord::Base
belongs_to :post belongs_to :post

View File

@ -1,3 +1,18 @@
# == 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 class PostTiming < ActiveRecord::Base
belongs_to :topic belongs_to :topic
belongs_to :user belongs_to :user

View File

@ -1,3 +1,17 @@
# == 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_type'
require_dependency 'site_content_class_methods' require_dependency 'site_content_class_methods'

View File

@ -1,3 +1,25 @@
# == 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 class SiteCustomization < ActiveRecord::Base
ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd' ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd'
# placing this in uploads to ease deployment rules # placing this in uploads to ease deployment rules

View File

@ -1,3 +1,15 @@
# == 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' require 'site_setting_extension'
class SiteSetting < ActiveRecord::Base class SiteSetting < ActiveRecord::Base

View File

@ -1,3 +1,59 @@
# == 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 'slug'
require_dependency 'avatar_lookup' require_dependency 'avatar_lookup'
require_dependency 'topic_view' require_dependency 'topic_view'

View File

@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: topic_allowed_groups
#
# id :integer not null, primary key
# group_id :integer not null
# topic_id :integer not null
#
# Indexes
#
# index_topic_allowed_groups_on_group_id_and_topic_id (group_id,topic_id) UNIQUE
# index_topic_allowed_groups_on_topic_id_and_group_id (topic_id,group_id) UNIQUE
#
class TopicAllowedGroup < ActiveRecord::Base class TopicAllowedGroup < ActiveRecord::Base
belongs_to :topic belongs_to :topic
belongs_to :group belongs_to :group

View File

@ -1,3 +1,19 @@
# == Schema Information
#
# Table name: topic_allowed_users
#
# id :integer not null, primary key
# user_id :integer not null
# topic_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_topic_allowed_users_on_topic_id_and_user_id (topic_id,user_id) UNIQUE
# index_topic_allowed_users_on_user_id_and_topic_id (user_id,topic_id) UNIQUE
#
class TopicAllowedUser < ActiveRecord::Base class TopicAllowedUser < ActiveRecord::Base
belongs_to :topic belongs_to :topic
belongs_to :user belongs_to :user

View File

@ -1,3 +1,19 @@
# == Schema Information
#
# Table name: topic_invites
#
# id :integer not null, primary key
# topic_id :integer not null
# invite_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_topic_invites_on_invite_id (invite_id)
# index_topic_invites_on_topic_id_and_invite_id (topic_id,invite_id) UNIQUE
#
class TopicInvite < ActiveRecord::Base class TopicInvite < ActiveRecord::Base
belongs_to :topic belongs_to :topic
belongs_to :invite belongs_to :invite

View File

@ -1,3 +1,27 @@
# == 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 'uri'
require_dependency 'slug' require_dependency 'slug'

View File

@ -1,3 +1,19 @@
# == 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_dependency 'discourse'
require 'ipaddr' require 'ipaddr'

View File

@ -1,3 +1,28 @@
# == 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 class TopicUser < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :topic belongs_to :topic

View File

@ -1,3 +1,20 @@
# == Schema Information
#
# Table name: twitter_user_infos
#
# id :integer not null, primary key
# user_id :integer not null
# screen_name :string(255) not null
# twitter_user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_twitter_user_infos_on_twitter_user_id (twitter_user_id) UNIQUE
# index_twitter_user_infos_on_user_id (user_id) UNIQUE
#
class TwitterUserInfo < ActiveRecord::Base class TwitterUserInfo < ActiveRecord::Base
belongs_to :user belongs_to :user
end end

View File

@ -1,3 +1,24 @@
# == 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' require 'digest/sha1'
class Upload < ActiveRecord::Base class Upload < ActiveRecord::Base

View File

@ -1,3 +1,63 @@
# == 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'
require_dependency 'email_token' require_dependency 'email_token'
require_dependency 'trust_level' require_dependency 'trust_level'

View File

@ -1,3 +1,24 @@
# == 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 class UserAction < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :target_post, class_name: "Post" belongs_to :target_post, class_name: "Post"

View File

@ -1,3 +1,20 @@
# == Schema Information
#
# Table name: user_open_ids
#
# id :integer not null, primary key
# user_id :integer not null
# email :string(255) not null
# url :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# active :boolean not null
#
# Indexes
#
# index_user_open_ids_on_url (url)
#
class UserOpenId < ActiveRecord::Base class UserOpenId < ActiveRecord::Base
belongs_to :user belongs_to :user
attr_accessible :email, :url, :user_id, :active attr_accessible :email, :url, :user_id, :active

View File

@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: user_search_data
#
# user_id :integer not null, primary key
# search_data :tsvector
#
# Indexes
#
# idx_search_user (search_data)
#
class UserSearchData < ActiveRecord::Base class UserSearchData < ActiveRecord::Base
belongs_to :user belongs_to :user
validates_presence_of :search_data validates_presence_of :search_data

View File

@ -1,3 +1,16 @@
# == 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 class UserVisit < ActiveRecord::Base
attr_accessible :visited_at, :user_id attr_accessible :visited_at, :user_id

View File

@ -1,3 +1,18 @@
# == 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' require 'ipaddr'
class View < ActiveRecord::Base class View < ActiveRecord::Base

View File

@ -0,0 +1,34 @@
# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if(Rails.env.development?)
task :set_annotation_options do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults({
'position_in_routes' => "before",
'position_in_class' => "before",
'position_in_test' => "before",
'position_in_fixture' => "before",
'position_in_factory' => "before",
'show_indexes' => "true",
'simple_indexes' => "false",
'model_dir' => "app/models",
'include_version' => "false",
'require' => "",
'exclude_tests' => "true",
'exclude_fixtures' => "true",
'exclude_factories' => "true",
'ignore_model_sub_dir' => "false",
'skip_on_db_migrate' => "false",
'format_bare' => "true",
'format_rdoc' => "false",
'format_markdown' => "false",
'sort' => "false",
'force' => "false",
'trace' => "false",
})
end
Annotate.load_tasks
end