Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

Commit 7e4886f

Browse files
authored
drop comments table (#1201)
fixes #1192
1 parent c0178ce commit 7e4886f

11 files changed

+25
-186
lines changed

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ruby "2.6.6"
77

88
gem "active_link_to", "~> 1.0.5"
99
gem "active_storage_svg_sanitizer", "~> 0.1.0"
10-
gem "acts_as_commentable_with_threading", "~> 2.0.1"
1110
gem "aws-sdk-s3", "~> 1.61.1", require: false
1211
gem "barnes", "~> 0.0.7"
1312
gem "bootsnap", ">= 1.4.2", require: false

Gemfile.lock

-7
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,13 @@ GEM
6767
minitest (~> 5.1)
6868
tzinfo (~> 1.1)
6969
zeitwerk (~> 2.2)
70-
acts_as_commentable_with_threading (2.0.1)
71-
activerecord (>= 4.0)
72-
activesupport (>= 4.0)
73-
awesome_nested_set (>= 3.0)
7470
addressable (2.7.0)
7571
public_suffix (>= 2.0.2, < 5.0)
7672
annotate (3.1.0)
7773
activerecord (>= 3.2, < 7.0)
7874
rake (>= 10.4, < 14.0)
7975
ansi (1.5.0)
8076
ast (2.4.0)
81-
awesome_nested_set (3.2.0)
82-
activerecord (>= 4.0.0, < 7.0)
8377
awesome_print (1.8.0)
8478
aws-eventstream (1.0.3)
8579
aws-partitions (1.288.0)
@@ -589,7 +583,6 @@ PLATFORMS
589583
DEPENDENCIES
590584
active_link_to (~> 1.0.5)
591585
active_storage_svg_sanitizer (~> 0.1.0)
592-
acts_as_commentable_with_threading (~> 2.0.1)
593586
annotate
594587
awesome_print
595588
aws-sdk-s3 (~> 1.61.1)

PROSPECTUS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Each template uses an ad creative that follows these guidelines:
7171

7272
* Ad creative **headline** + **body** should not be more than **84 characters long**.
7373
* Banner image may not be animated.
74-
* We recomment the use of 👋 emoji when it makes sense, but don't overuse it.
74+
* We recommend the use of 👋 emoji when it makes sense, but don't overuse it.
7575

7676
We are software developers first and foremost. We will help you craft a message that resonates with the developer community if needed.
7777

app/models/campaign.rb

-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ class Campaign < ApplicationRecord
253253
tag_columns :audience_ids
254254
tag_columns :keywords
255255
tag_columns :negative_keywords
256-
acts_as_commentable
257256
has_paper_trail on: %i[create update destroy], version_limit: nil, only: %i[
258257
core_hours_only
259258
country_codes

app/models/comment.rb

-85
This file was deleted.

app/models/organization.rb

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class Organization < ApplicationRecord
7171
# additional config (i.e. accepts_nested_attribute_for etc...) ..............
7272
attr_accessor :skip_validation
7373
monetize :balance_cents, numericality: true
74-
acts_as_commentable
7574
has_paper_trail on: %i[update destroy], only: %i[
7675
name
7776
]

app/models/property.rb

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ class Property < ApplicationRecord
142142
tag_columns :prohibited_advertiser_ids
143143
tag_columns :keywords
144144
has_one_attached :screenshot
145-
acts_as_commentable
146145
has_paper_trail on: %i[update], only: %i[
147146
ad_template
148147
ad_theme

app/models/user.rb

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ class User < ApplicationRecord
180180
)
181181
has_one_attached :avatar
182182
accepts_nested_attributes_for :organization_users, reject_if: proc { |attributes| attributes["organization_id"].blank? || attributes["role"].blank? }
183-
acts_as_commentable
184183
has_paper_trail on: %i[update], only: %i[
185184
api_access
186185
api_key
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class DropCommentsTable < ActiveRecord::Migration[6.0]
2+
def up
3+
drop_table :comments
4+
end
5+
6+
def down
7+
create_table :comments, force: true do |t|
8+
t.bigint :commentable_id
9+
t.string :commentable_type
10+
t.string :title
11+
t.text :body
12+
t.string :subject
13+
t.bigint :user_id, null: false
14+
t.bigint :parent_id, :lft, :rgt
15+
t.timestamps
16+
end
17+
18+
add_index :comments, :user_id
19+
add_index :comments, [:commentable_id, :commentable_type]
20+
end
21+
end

db/schema.rb

+1-17
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2020_03_25_201726) do
13+
ActiveRecord::Schema.define(version: 2020_04_06_223804) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "pg_stat_statements"
@@ -119,22 +119,6 @@
119119
t.index ["weekdays_only"], name: "index_campaigns_on_weekdays_only"
120120
end
121121

122-
create_table "comments", force: :cascade do |t|
123-
t.bigint "commentable_id", null: false
124-
t.string "commentable_type", null: false
125-
t.string "title"
126-
t.text "body"
127-
t.string "subject"
128-
t.bigint "user_id", null: false
129-
t.bigint "parent_id"
130-
t.integer "lft"
131-
t.integer "rgt"
132-
t.datetime "created_at", null: false
133-
t.datetime "updated_at", null: false
134-
t.index ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type"
135-
t.index ["user_id"], name: "index_comments_on_user_id"
136-
end
137-
138122
create_table "coupons", force: :cascade do |t|
139123
t.string "code", null: false
140124
t.string "description"

db/structure.sql

+2-71
Original file line numberDiff line numberDiff line change
@@ -296,45 +296,6 @@ CREATE SEQUENCE public.campaigns_id_seq
296296
ALTER SEQUENCE public.campaigns_id_seq OWNED BY public.campaigns.id;
297297

298298

299-
--
300-
-- Name: comments; Type: TABLE; Schema: public; Owner: -
301-
--
302-
303-
CREATE TABLE public.comments (
304-
id bigint NOT NULL,
305-
commentable_id bigint NOT NULL,
306-
commentable_type character varying NOT NULL,
307-
title character varying,
308-
body text,
309-
subject character varying,
310-
user_id bigint NOT NULL,
311-
parent_id bigint,
312-
lft integer,
313-
rgt integer,
314-
created_at timestamp without time zone NOT NULL,
315-
updated_at timestamp without time zone NOT NULL
316-
);
317-
318-
319-
--
320-
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
321-
--
322-
323-
CREATE SEQUENCE public.comments_id_seq
324-
START WITH 1
325-
INCREMENT BY 1
326-
NO MINVALUE
327-
NO MAXVALUE
328-
CACHE 1;
329-
330-
331-
--
332-
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
333-
--
334-
335-
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
336-
337-
338299
--
339300
-- Name: coupons; Type: TABLE; Schema: public; Owner: -
340301
--
@@ -1401,13 +1362,6 @@ ALTER TABLE ONLY public.campaign_bundles ALTER COLUMN id SET DEFAULT nextval('pu
14011362
ALTER TABLE ONLY public.campaigns ALTER COLUMN id SET DEFAULT nextval('public.campaigns_id_seq'::regclass);
14021363

14031364

1404-
--
1405-
-- Name: comments id; Type: DEFAULT; Schema: public; Owner: -
1406-
--
1407-
1408-
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
1409-
1410-
14111365
--
14121366
-- Name: coupons id; Type: DEFAULT; Schema: public; Owner: -
14131367
--
@@ -1567,14 +1521,6 @@ ALTER TABLE ONLY public.campaigns
15671521
ADD CONSTRAINT campaigns_pkey PRIMARY KEY (id);
15681522

15691523

1570-
--
1571-
-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1572-
--
1573-
1574-
ALTER TABLE ONLY public.comments
1575-
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
1576-
1577-
15781524
--
15791525
-- Name: coupons coupons_pkey; Type: CONSTRAINT; Schema: public; Owner: -
15801526
--
@@ -2146,20 +2092,6 @@ CREATE INDEX index_campaigns_on_user_id ON public.campaigns USING btree (user_id
21462092
CREATE INDEX index_campaigns_on_weekdays_only ON public.campaigns USING btree (weekdays_only);
21472093

21482094

2149-
--
2150-
-- Name: index_comments_on_commentable_id_and_commentable_type; Type: INDEX; Schema: public; Owner: -
2151-
--
2152-
2153-
CREATE INDEX index_comments_on_commentable_id_and_commentable_type ON public.comments USING btree (commentable_id, commentable_type);
2154-
2155-
2156-
--
2157-
-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2158-
--
2159-
2160-
CREATE INDEX index_comments_on_user_id ON public.comments USING btree (user_id);
2161-
2162-
21632095
--
21642096
-- Name: index_coupons_on_code; Type: INDEX; Schema: public; Owner: -
21652097
--
@@ -2912,6 +2844,5 @@ INSERT INTO "schema_migrations" (version) VALUES
29122844
('20200220160136'),
29132845
('20200221220825'),
29142846
('20200303224134'),
2915-
('20200325201726');
2916-
2917-
2847+
('20200325201726'),
2848+
('20200406223804');

0 commit comments

Comments
 (0)