updated tag unit tests

This commit is contained in:
albert
2010-02-11 14:59:58 -05:00
parent 2f3a6e4a8b
commit bed94a4e30
21 changed files with 731 additions and 269 deletions

View File

@@ -113,6 +113,76 @@ CREATE SEQUENCE pending_posts_id_seq
ALTER SEQUENCE pending_posts_id_seq OWNED BY pending_posts.id;
--
-- Name: pool_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE pool_versions (
id integer NOT NULL,
pool_id integer,
post_ids text DEFAULT ''::text NOT NULL,
updater_id integer NOT NULL,
updater_ip_addr inet NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: pool_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE pool_versions_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: pool_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE pool_versions_id_seq OWNED BY pool_versions.id;
--
-- Name: pools; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE pools (
id integer NOT NULL,
name character varying(255),
creator_id integer NOT NULL,
description text,
is_public boolean DEFAULT true NOT NULL,
is_active boolean DEFAULT true NOT NULL,
post_ids text DEFAULT ''::text NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: pools_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE pools_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: pools_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE pools_id_seq OWNED BY pools.id;
--
-- Name: post_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@@ -174,7 +244,7 @@ CREATE TABLE posts (
view_count integer DEFAULT 0 NOT NULL,
last_noted_at timestamp without time zone,
last_commented_at timestamp without time zone,
tag_string text NOT NULL,
tag_string text DEFAULT ''::text NOT NULL,
tag_index tsvector,
tag_count integer DEFAULT 0 NOT NULL,
tag_count_general integer DEFAULT 0 NOT NULL,
@@ -341,6 +411,20 @@ ALTER SEQUENCE users_id_seq OWNED BY users.id;
ALTER TABLE pending_posts ALTER COLUMN id SET DEFAULT nextval('pending_posts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE pool_versions ALTER COLUMN id SET DEFAULT nextval('pool_versions_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE pools ALTER COLUMN id SET DEFAULT nextval('pools_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -384,6 +468,22 @@ ALTER TABLE ONLY pending_posts
ADD CONSTRAINT pending_posts_pkey PRIMARY KEY (id);
--
-- Name: pool_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY pool_versions
ADD CONSTRAINT pool_versions_pkey PRIMARY KEY (id);
--
-- Name: pools_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY pools
ADD CONSTRAINT pools_pkey PRIMARY KEY (id);
--
-- Name: post_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -424,6 +524,27 @@ ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: index_pool_versions_on_pool_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pool_versions_on_pool_id ON pool_versions USING btree (pool_id);
--
-- Name: index_pools_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pools_on_creator_id ON pools USING btree (creator_id);
--
-- Name: index_pools_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pools_on_name ON pools USING btree (name);
--
-- Name: index_post_versions_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -574,4 +695,6 @@ INSERT INTO schema_migrations (version) VALUES ('20100205163027');
INSERT INTO schema_migrations (version) VALUES ('20100205224030');
INSERT INTO schema_migrations (version) VALUES ('20100209201251');
INSERT INTO schema_migrations (version) VALUES ('20100209201251');
INSERT INTO schema_migrations (version) VALUES ('20100211025616');

View File

@@ -0,0 +1,31 @@
class CreatePools < ActiveRecord::Migration
def self.up
create_table :pools do |t|
t.column :name, :string
t.column :creator_id, :integer, :null => false
t.column :description, :text
t.column :is_public, :boolean, :null => false, :default => true
t.column :is_active, :boolean, :null => false, :default => true
t.column :post_ids, :text, :null => false, :default => ""
t.timestamps
end
add_index :pools, :name
add_index :pools, :creator_id
create_table :pool_versions do |t|
t.column :pool_id, :integer
t.column :post_ids, :text, :null => false, :default => ""
t.column :updater_id, :integer, :null => false
t.column :updater_ip_addr, "inet", :null => false
t.timestamps
end
add_index :pool_versions, :pool_id
end
def self.down
drop_table :pools
end
end

View File

@@ -0,0 +1,19 @@
class CreateFavorites < ActiveRecord::Migration
def self.up
(0..9).each do |number|
create_table "favorites_#{number}" do |t|
t.column :post_id, :integer
t.column :user_id, :integer
end
add_index "favorites_#{number}", :post_id
add_index "favorites_#{number}", :user_id
end
end
def self.down
(0..9).each do |number|
drop_table "favorites_#{number}"
end
end
end

View File

@@ -0,0 +1,17 @@
class CreateTagAliases < ActiveRecord::Migration
def self.up
create_table :tag_aliases do |t|
t.column :antecedent_name, :string, :null => false
t.column :consequent_name, :string, :null => false
t.column :creator_id, :integer, :null => false
t.column :request_ids, :string
t.timestamps
end
add_index :tag_aliases, :antecedent_name
end
def self.down
drop_table :tag_aliases
end
end

View File

@@ -0,0 +1,18 @@
class CreateTagImplications < ActiveRecord::Migration
def self.up
create_table :tag_implications do |t|
t.column :antecedent_name, :string, :null => false
t.column :consequent_name, :string, :null => false
t.column :descendant_names, :text, :null => false
t.column :creator_id, :integer, :null => false
t.column :request_ids, :string
t.timestamps
end
add_index :tag_implications, :antecedent_name
end
def self.down
drop_table :tag_implications
end
end