added artists, comments
This commit is contained in:
@@ -74,6 +74,181 @@ SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- Name: artist_urls; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE artist_urls (
|
||||
id integer NOT NULL,
|
||||
artist_id integer NOT NULL,
|
||||
url text NOT NULL,
|
||||
normalized_url text NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_urls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE artist_urls_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_urls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE artist_urls_id_seq OWNED BY artist_urls.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE artist_versions (
|
||||
id integer NOT NULL,
|
||||
artist_id integer NOT NULL,
|
||||
name character varying(255) NOT NULL,
|
||||
updater_id integer NOT NULL,
|
||||
updater_ip_addr inet NOT NULL,
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
other_names text,
|
||||
group_name character varying(255),
|
||||
url_string text,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE artist_versions_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE artist_versions_id_seq OWNED BY artist_versions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artists; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE artists (
|
||||
id integer NOT NULL,
|
||||
name character varying(255) NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
other_names text,
|
||||
other_names_index tsvector,
|
||||
group_name character varying(255),
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artists_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE artists_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE artists_id_seq OWNED BY artists.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: comment_votes; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE comment_votes (
|
||||
id integer NOT NULL,
|
||||
comment_id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comment_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE comment_votes_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: comment_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE comment_votes_id_seq OWNED BY comment_votes.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE comments (
|
||||
id integer NOT NULL,
|
||||
post_id integer NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
body text NOT NULL,
|
||||
ip_addr inet NOT NULL,
|
||||
body_index tsvector NOT NULL,
|
||||
score integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE comments_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: favorites_0; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -773,6 +948,76 @@ CREATE SEQUENCE users_id_seq
|
||||
ALTER SEQUENCE users_id_seq OWNED BY users.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE wiki_pages (
|
||||
id integer NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
title character varying(255) NOT NULL,
|
||||
body text NOT NULL,
|
||||
body_index tsvector NOT NULL,
|
||||
is_locked boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE wiki_pages_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE wiki_pages_id_seq OWNED BY wiki_pages.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE artist_urls ALTER COLUMN id SET DEFAULT nextval('artist_urls_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE artist_versions ALTER COLUMN id SET DEFAULT nextval('artist_versions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE artists ALTER COLUMN id SET DEFAULT nextval('artists_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE comment_votes ALTER COLUMN id SET DEFAULT nextval('comment_votes_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -913,6 +1158,53 @@ ALTER TABLE uploads ALTER COLUMN id SET DEFAULT nextval('uploads_id_seq'::regcla
|
||||
ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE wiki_pages ALTER COLUMN id SET DEFAULT nextval('wiki_pages_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_urls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY artist_urls
|
||||
ADD CONSTRAINT artist_urls_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY artist_versions
|
||||
ADD CONSTRAINT artist_versions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artists_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY artists
|
||||
ADD CONSTRAINT artists_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comment_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY comment_votes
|
||||
ADD CONSTRAINT comment_votes_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY comments
|
||||
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: favorites_0_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1073,6 +1365,91 @@ ALTER TABLE ONLY users
|
||||
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY wiki_pages
|
||||
ADD CONSTRAINT wiki_pages_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artist_urls_on_artist_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artist_urls_on_artist_id ON artist_urls USING btree (artist_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artist_urls_on_normalized_url; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artist_urls_on_normalized_url ON artist_urls USING btree (normalized_url);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artist_versions_on_artist_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artist_versions_on_artist_id ON artist_versions USING btree (artist_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artist_versions_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artist_versions_on_name ON artist_versions USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artist_versions_on_updater_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artist_versions_on_updater_id ON artist_versions USING btree (updater_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artists_on_group_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artists_on_group_name ON artists USING btree (group_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artists_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_artists_on_name ON artists USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_artists_on_other_names_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_artists_on_other_names_index ON artists USING gin (other_names_index);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_comment_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_comment_votes_on_user_id ON comment_votes USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_comments_on_body_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_comments_on_body_index ON comments USING gin (body_index);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_comments_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_comments_on_post_id ON comments USING btree (post_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_favorites_0_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1332,6 +1709,13 @@ CREATE INDEX index_posts_on_view_count ON posts USING btree (view_count);
|
||||
CREATE INDEX index_tag_aliases_on_antecedent_name ON tag_aliases USING btree (antecedent_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_tag_aliases_on_consequent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_tag_aliases_on_consequent_name ON tag_aliases USING btree (consequent_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_tag_implications_on_antecedent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1339,6 +1723,13 @@ CREATE INDEX index_tag_aliases_on_antecedent_name ON tag_aliases USING btree (an
|
||||
CREATE INDEX index_tag_implications_on_antecedent_name ON tag_implications USING btree (antecedent_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_tag_implications_on_consequent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_tag_implications_on_consequent_name ON tag_implications USING btree (consequent_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_tags_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1367,6 +1758,20 @@ CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);
|
||||
CREATE UNIQUE INDEX index_users_on_name ON users USING btree (lower((name)::text));
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_wiki_pages_on_body_index_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_wiki_pages_on_body_index_index ON wiki_pages USING gin (body_index);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_wiki_pages_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_wiki_pages_on_title ON wiki_pages USING btree (title);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1374,6 +1779,26 @@ CREATE UNIQUE INDEX index_users_on_name ON users USING btree (lower((name)::text
|
||||
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
|
||||
|
||||
|
||||
--
|
||||
-- Name: trigger_artists_on_update; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TRIGGER trigger_artists_on_update
|
||||
BEFORE INSERT OR UPDATE ON artists
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE tsvector_update_trigger('other_names_index', 'public.danbooru', 'other_names');
|
||||
|
||||
|
||||
--
|
||||
-- Name: trigger_comments_on_update; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TRIGGER trigger_comments_on_update
|
||||
BEFORE INSERT OR UPDATE ON comments
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body');
|
||||
|
||||
|
||||
--
|
||||
-- Name: trigger_posts_on_tag_index_update; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1384,6 +1809,16 @@ CREATE TRIGGER trigger_posts_on_tag_index_update
|
||||
EXECUTE PROCEDURE tsvector_update_trigger('tag_index', 'public.danbooru', 'tag_string', 'fav_string', 'pool_string', 'uploader_string', 'approver_string');
|
||||
|
||||
|
||||
--
|
||||
-- Name: trigger_wiki_pages_on_update; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TRIGGER trigger_wiki_pages_on_update
|
||||
BEFORE INSERT OR UPDATE ON wiki_pages
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'public.danbooru', 'body', 'title');
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
@@ -1406,4 +1841,16 @@ INSERT INTO schema_migrations (version) VALUES ('20100211181944');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100211191709');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100211191716');
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100211191716');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100213181847');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100213183712');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100214080549');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100214080557');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100214080605');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100215182234');
|
||||
21
db/migrate/20100213181847_create_comments.rb
Normal file
21
db/migrate/20100213181847_create_comments.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class CreateComments < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :comments do |t|
|
||||
t.column :post_id, :integer, :null => false
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :body, :text, :null => false
|
||||
t.column :ip_addr, "inet", :null => false
|
||||
t.column :body_index, "tsvector", :null => false
|
||||
t.column :score, :integer, :null => false, :default => 0
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :comments, :post_id
|
||||
execute "CREATE INDEX index_comments_on_body_index ON comments USING GIN (body_index)"
|
||||
execute "CREATE TRIGGER trigger_comments_on_update BEFORE INSERT OR UPDATE ON comments FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body')"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :comments
|
||||
end
|
||||
end
|
||||
15
db/migrate/20100213183712_create_comment_votes.rb
Normal file
15
db/migrate/20100213183712_create_comment_votes.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateCommentVotes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :comment_votes do |t|
|
||||
t.column :comment_id, :integer, :null => false
|
||||
t.column :user_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :comment_votes, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :comment_votes
|
||||
end
|
||||
end
|
||||
22
db/migrate/20100214080549_create_artists.rb
Normal file
22
db/migrate/20100214080549_create_artists.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class CreateArtists < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :artists do |t|
|
||||
t.column :name, :string, :null => false
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :is_active, :boolean, :null => false, :default => true
|
||||
t.column :other_names, :text
|
||||
t.column :other_names_index, "tsvector"
|
||||
t.column :group_name, :string
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :artists, :name, :unique => true
|
||||
add_index :artists, :group_name
|
||||
execute "CREATE INDEX index_artists_on_other_names_index ON artists USING GIN (other_names_index)"
|
||||
execute "CREATE TRIGGER trigger_artists_on_update BEFORE INSERT OR UPDATE ON artists FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('other_names_index', 'public.danbooru', 'other_names')"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :artists
|
||||
end
|
||||
end
|
||||
23
db/migrate/20100214080557_create_artist_versions.rb
Normal file
23
db/migrate/20100214080557_create_artist_versions.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class CreateArtistVersions < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :artist_versions do |t|
|
||||
t.column :artist_id, :integer, :null => false
|
||||
t.column :name, :string, :null => false
|
||||
t.column :updater_id, :integer, :null => false
|
||||
t.column :updater_ip_addr, "inet", :null => false
|
||||
t.column :is_active, :boolean, :null => false, :default => true
|
||||
t.column :other_names, :text
|
||||
t.column :group_name, :string
|
||||
t.column :url_string, :text
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :artist_versions, :artist_id
|
||||
add_index :artist_versions, :name
|
||||
add_index :artist_versions, :updater_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :artist_versions
|
||||
end
|
||||
end
|
||||
17
db/migrate/20100214080605_create_artist_urls.rb
Normal file
17
db/migrate/20100214080605_create_artist_urls.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateArtistUrls < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :artist_urls do |t|
|
||||
t.column :artist_id, :integer, :null => false
|
||||
t.column :url, :text, :null => false
|
||||
t.column :normalized_url, :text, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :artist_urls, :artist_id
|
||||
add_index :artist_urls, :normalized_url
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :artist_urls
|
||||
end
|
||||
end
|
||||
20
db/migrate/20100215182234_create_wiki_pages.rb
Normal file
20
db/migrate/20100215182234_create_wiki_pages.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class CreateWikiPages < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :wiki_pages do |t|
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :title, :string, :null => false
|
||||
t.column :body, :text, :null => false
|
||||
t.column :body_index, "tsvector", :null => false
|
||||
t.column :is_locked, :boolean, :null => false, :default => false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wiki_pages, :title, :unique => true
|
||||
execute "CREATE INDEX index_wiki_pages_on_body_index_index ON wiki_pages USING GIN (body_index)"
|
||||
execute "CREATE TRIGGER trigger_wiki_pages_on_update BEFORE INSERT OR UPDATE ON wiki_pages FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'public.danbooru', 'body', 'title')"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :wiki_pages
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user