From 2db3cfb16b43ce2042d8940cdff2cb1f80eb5361 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 5 Dec 2013 17:40:35 +1100 Subject: [PATCH] annotate models --- app/models/api_key.rb | 17 +++++++++++++ app/models/category.rb | 40 +++++++++++++++++-------------- app/models/incoming_link.rb | 3 +-- app/models/post.rb | 2 +- app/models/post_detail.rb | 17 +++++++++++++ app/models/screened_email.rb | 3 +-- app/models/screened_ip_address.rb | 18 ++++++++++++++ app/models/screened_url.rb | 3 +-- app/models/topic.rb | 2 +- app/models/topic_link_click.rb | 3 +-- app/models/upload.rb | 2 +- app/models/user.rb | 3 +-- app/models/view.rb | 3 +-- 13 files changed, 83 insertions(+), 33 deletions(-) diff --git a/app/models/api_key.rb b/app/models/api_key.rb index 475ccbe91..c1daf8ad0 100644 --- a/app/models/api_key.rb +++ b/app/models/api_key.rb @@ -20,3 +20,20 @@ class ApiKey < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: api_keys +# +# id :integer not null, primary key +# key :string(64) not null +# user_id :integer +# created_by_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_api_keys_on_key (key) +# index_api_keys_on_user_id (user_id) UNIQUE +# diff --git a/app/models/category.rb b/app/models/category.rb index b5b32cf9d..36b2e4f0d 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -293,27 +293,31 @@ end # # 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 -# read_restricted :boolean default(FALSE), not null -# auto_close_days :float +# 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 +# read_restricted :boolean default(FALSE), not null +# auto_close_days :float +# post_count :integer default(0), not null +# latest_post_id :integer +# latest_topic_id :integer +# position :integer not null +# parent_category_id :integer # # Indexes # # index_categories_on_forum_thread_count (topic_count) # index_categories_on_name (name) UNIQUE # - diff --git a/app/models/incoming_link.rb b/app/models/incoming_link.rb index 8652daef3..c9656f0ac 100644 --- a/app/models/incoming_link.rb +++ b/app/models/incoming_link.rb @@ -102,7 +102,7 @@ end # created_at :datetime not null # updated_at :datetime not null # user_id :integer -# ip_address :string +# ip_address :inet # current_user_id :integer # # Indexes @@ -111,4 +111,3 @@ end # index_incoming_links_on_created_at_and_domain (created_at,domain) # index_incoming_links_on_created_at_and_user_id (created_at,user_id) # - diff --git a/app/models/post.rb b/app/models/post.rb index 50571a359..3cd907702 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -455,6 +455,7 @@ end # notify_user_count :integer default(0), not null # like_score :integer default(0), not null # deleted_by_id :integer +# edit_reason :string(255) # # Indexes # @@ -462,4 +463,3 @@ end # index_posts_on_reply_to_post_number (reply_to_post_number) # index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE # - diff --git a/app/models/post_detail.rb b/app/models/post_detail.rb index e3e826251..8f8885167 100644 --- a/app/models/post_detail.rb +++ b/app/models/post_detail.rb @@ -4,3 +4,20 @@ class PostDetail < ActiveRecord::Base validates_presence_of :key, :value validates_uniqueness_of :key, scope: :post_id end + +# == Schema Information +# +# Table name: post_details +# +# id :integer not null, primary key +# post_id :integer +# key :string(255) +# value :string(255) +# extra :text +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_post_details_on_post_id_and_key (post_id,key) UNIQUE +# diff --git a/app/models/screened_email.rb b/app/models/screened_email.rb index 0541cb3dd..99c940b03 100644 --- a/app/models/screened_email.rb +++ b/app/models/screened_email.rb @@ -35,11 +35,10 @@ end # last_match_at :datetime # created_at :datetime not null # updated_at :datetime not null -# ip_address :string +# ip_address :inet # # Indexes # # index_blocked_emails_on_email (email) UNIQUE # index_blocked_emails_on_last_match_at (last_match_at) # - diff --git a/app/models/screened_ip_address.rb b/app/models/screened_ip_address.rb index 32ec2832d..7941543b3 100644 --- a/app/models/screened_ip_address.rb +++ b/app/models/screened_ip_address.rb @@ -50,3 +50,21 @@ class ScreenedIpAddress < ActiveRecord::Base !!b and b.action_type == action_type end end + +# == Schema Information +# +# Table name: screened_ip_addresses +# +# id :integer not null, primary key +# ip_address :inet not null +# action_type :integer not null +# match_count :integer default(0), not null +# last_match_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_screened_ip_addresses_on_ip_address (ip_address) UNIQUE +# index_screened_ip_addresses_on_last_match_at (last_match_at) +# diff --git a/app/models/screened_url.rb b/app/models/screened_url.rb index 5f54a9ecb..5abe8aced 100644 --- a/app/models/screened_url.rb +++ b/app/models/screened_url.rb @@ -49,11 +49,10 @@ end # last_match_at :datetime # created_at :datetime not null # updated_at :datetime not null -# ip_address :string +# ip_address :inet # # Indexes # # index_screened_urls_on_last_match_at (last_match_at) # index_screened_urls_on_url (url) UNIQUE # - diff --git a/app/models/topic.rb b/app/models/topic.rb index 6de610381..3112e197a 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -729,6 +729,7 @@ end # auto_close_user_id :integer # auto_close_started_at :datetime # deleted_by_id :integer +# participant_count :integer default(1) # # Indexes # @@ -737,4 +738,3 @@ end # index_topics_on_deleted_at_and_visible_and_archetype_and_id (deleted_at,visible,archetype,id) # index_topics_on_id_and_deleted_at (id,deleted_at) # - diff --git a/app/models/topic_link_click.rb b/app/models/topic_link_click.rb index 5fa832a84..ba79e5233 100644 --- a/app/models/topic_link_click.rb +++ b/app/models/topic_link_click.rb @@ -53,10 +53,9 @@ end # user_id :integer # created_at :datetime not null # updated_at :datetime not null -# ip_address :string not null +# ip_address :inet not null # # Indexes # # index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id) # - diff --git a/app/models/upload.rb b/app/models/upload.rb index 051dceb5a..0708198b2 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -111,6 +111,7 @@ end # created_at :datetime not null # updated_at :datetime not null # sha1 :string(40) +# origin :string(1000) # # Indexes # @@ -119,4 +120,3 @@ end # index_uploads_on_url (url) # index_uploads_on_user_id (user_id) # - diff --git a/app/models/user.rb b/app/models/user.rb index 7975bc7b5..f175dfd03 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -635,7 +635,7 @@ end # auto_track_topics_after_msecs :integer # views :integer default(0), not null # flag_level :integer default(0), not null -# ip_address :string +# ip_address :inet # new_topic_duration_minutes :integer # external_links_in_new_tab :boolean default(FALSE), not null # enable_quoting :boolean default(TRUE), not null @@ -656,4 +656,3 @@ end # index_users_on_username (username) UNIQUE # index_users_on_username_lower (username_lower) UNIQUE # - diff --git a/app/models/view.rb b/app/models/view.rb index d0c641c7a..8033d03a2 100644 --- a/app/models/view.rb +++ b/app/models/view.rb @@ -42,11 +42,10 @@ end # parent_type :string(50) not null # viewed_at :date not null # user_id :integer -# ip_address :string not null +# ip_address :inet not null # # Indexes # # index_views_on_parent_id_and_parent_type (parent_id,parent_type) # index_views_on_user_id_and_parent_type_and_parent_id (user_id,parent_type,parent_id) # -