# resolved_at :datetime
# resolved_by :integer
# updated_by :integer
+# reports_count :integer default(0)
# created_at :datetime not null
# updated_at :datetime not null
-# reports_count :integer default(0)
#
# Indexes
#
t.datetime :resolved_at
t.integer :resolved_by
t.integer :updated_by
+ t.integer :reports_count, :default => 0
t.timestamps :null => false
end
add_foreign_key :issues, :users, :column => :reported_user_id, :name => "issues_reported_user_id_fkey", :on_delete => :cascade
+ add_foreign_key :issues, :users, :column => :updated_by, :name => "issues_updated_by_fkey", :on_delete => :cascade
add_index :issues, :reported_user_id
add_index :issues, [:reportable_id, :reportable_type]
+ add_index :issues, :updated_by
create_table :reports do |t|
t.integer :issue_id
add_index :reports, :reporter_user_id
add_index :reports, :issue_id
+
+ create_table :issue_comments do |t|
+ t.integer :issue_id, :null => false
+ t.integer :commenter_user_id, :null => false
+ t.text :body, :null => false
+ t.timestamps :null => false
+ end
+
+ add_foreign_key :issue_comments, :issues, :name => "issue_comments_issue_id_fkey", :on_delete => :cascade
+ add_foreign_key :issue_comments, :users, :column => :commenter_user_id, :name => "issue_comments_commenter_user_id", :on_delete => :cascade
+
+ add_index :issue_comments, :commenter_user_id
+ add_index :issue_comments, :issue_id
end
end
+++ /dev/null
-class CreateIssueComments < ActiveRecord::Migration[5.0]
- def change
- create_table :issue_comments do |t|
- t.integer :issue_id, :null => false
- t.integer :commenter_user_id, :null => false
- t.text :body, :null => false
- t.timestamps :null => false
- end
-
- add_foreign_key :issue_comments, :issues, :name => "issue_comments_issue_id_fkey", :on_delete => :cascade
- add_foreign_key :issue_comments, :users, :column => :commenter_user_id, :name => "issue_comments_commenter_user_id", :on_delete => :cascade
-
- add_index :issue_comments, :commenter_user_id
- add_index :issue_comments, :issue_id
- end
-end
+++ /dev/null
-class AddReportsCountToIssues < ActiveRecord::Migration[5.0]
- def change
- add_column :issues, :reports_count, :integer, :default => 0
- add_foreign_key :issues, :users, :column => :updated_by, :name => "issues_updated_by_fkey", :on_delete => :cascade
- add_index :issues, :updated_by
- end
-end
resolved_at timestamp without time zone,
resolved_by integer,
updated_by integer,
+ reports_count integer DEFAULT 0,
created_at timestamp without time zone NOT NULL,
- updated_at timestamp without time zone NOT NULL,
- reports_count integer DEFAULT 0
+ updated_at timestamp without time zone NOT NULL
);
id integer NOT NULL,
issue_id integer,
reporter_user_id integer,
- details text,
+ details text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
('20150222101847'),
('20150818224516'),
('20160822153055'),
-('20160822153115'),
-('20160822153153'),
('20161002153425'),
('20161011010929'),
('20170222134109'),