added post voting
This commit is contained in:
@@ -655,6 +655,38 @@ CREATE SEQUENCE post_versions_id_seq
|
||||
ALTER SEQUENCE post_versions_id_seq OWNED BY post_versions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: post_votes; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE post_votes (
|
||||
id integer NOT NULL,
|
||||
post_id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: post_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE post_votes_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MAXVALUE
|
||||
NO MINVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: post_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE post_votes_id_seq OWNED BY post_votes.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: posts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1145,6 +1177,13 @@ ALTER TABLE pools ALTER COLUMN id SET DEFAULT nextval('pools_id_seq'::regclass);
|
||||
ALTER TABLE post_versions ALTER COLUMN id SET DEFAULT nextval('post_versions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE post_votes ALTER COLUMN id SET DEFAULT nextval('post_votes_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1352,6 +1391,14 @@ ALTER TABLE ONLY post_versions
|
||||
ADD CONSTRAINT post_versions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: post_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY post_votes
|
||||
ADD CONSTRAINT post_votes_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: posts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@@ -1913,4 +1960,6 @@ INSERT INTO schema_migrations (version) VALUES ('20100214080605');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100215182234');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100215213756');
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100215213756');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20100215223541');
|
||||
13
db/migrate/20100215223541_create_post_votes.rb
Normal file
13
db/migrate/20100215223541_create_post_votes.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreatePostVotes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :post_votes do |t|
|
||||
t.column :post_id, :integer, :null => false
|
||||
t.column :user_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :post_votes
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user