* Updated gemfile
* Added forum post/topic unit tests * Added forum post/topic controller tests
This commit is contained in:
@@ -400,7 +400,6 @@ CREATE TABLE dmails (
|
||||
owner_id integer NOT NULL,
|
||||
from_id integer NOT NULL,
|
||||
to_id integer NOT NULL,
|
||||
parent_id integer,
|
||||
title character varying(255) NOT NULL,
|
||||
body text NOT NULL,
|
||||
message_index tsvector NOT NULL,
|
||||
@@ -738,6 +737,7 @@ CREATE TABLE forum_posts (
|
||||
id integer NOT NULL,
|
||||
topic_id integer NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
updater_id integer NOT NULL,
|
||||
body text NOT NULL,
|
||||
text_index tsvector NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
@@ -771,6 +771,7 @@ ALTER SEQUENCE forum_posts_id_seq OWNED BY forum_posts.id;
|
||||
CREATE TABLE forum_topics (
|
||||
id integer NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
updater_id integer NOT NULL,
|
||||
title character varying(255) NOT NULL,
|
||||
response_count integer DEFAULT 0 NOT NULL,
|
||||
is_sticky boolean DEFAULT false NOT NULL,
|
||||
@@ -2386,13 +2387,6 @@ CREATE INDEX index_dmails_on_message_index ON dmails USING gin (message_index);
|
||||
CREATE INDEX index_dmails_on_owner_id ON dmails USING btree (owner_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_dmails_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_dmails_on_parent_id ON dmails USING btree (parent_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_favorites_0_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
@@ -2,6 +2,7 @@ class CreateForumTopics < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :forum_topics do |t|
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :updater_id, :integer, :null => false
|
||||
t.column :title, :string, :null => false
|
||||
t.column :response_count, :integer, :null => false, :default => 0
|
||||
t.column :is_sticky, :boolean, :null => false, :default => false
|
||||
|
||||
@@ -3,12 +3,13 @@ class CreateForumPosts < ActiveRecord::Migration
|
||||
create_table :forum_posts do |t|
|
||||
t.column :topic_id, :integer, :null => false
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :updater_id, :integer, :null => false
|
||||
t.column :body, :text, :null => false
|
||||
t.column :text_index, "tsvector", :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :forum_posts, :topic_id
|
||||
add_index :forum_posts, :topic_id
|
||||
add_index :forum_posts, :creator_id
|
||||
execute "CREATE INDEX index_forum_posts_on_text_index ON forum_posts USING GIN (text_index)"
|
||||
execute "CREATE TRIGGER trigger_forum_posts_on_update BEFORE INSERT OR UPDATE ON forum_posts FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'body')"
|
||||
|
||||
Reference in New Issue
Block a user