[Git][noosfero/noosfero][master] comment: add metadata to comment
Rodrigo Souto
gitlab at mg.gitlab.com
Fri Jul 7 13:29:00 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
1c9ce1e6 by Rodrigo Souto at 2017-07-07T13:27:40-03:00
comment: add metadata to comment
- - - - -
3 changed files:
- app/models/comment.rb
- + db/migrate/20170706154855_add_metadata_to_comments.rb
- db/schema.rb
Changes:
=====================================
app/models/comment.rb
=====================================
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -38,6 +38,9 @@ class Comment < ApplicationRecord
validate :article_archived?
+ store_accessor :metadata
+ include MetadataScopes
+
extend ActsAsHavingSettings::ClassMethods
acts_as_having_settings
=====================================
db/migrate/20170706154855_add_metadata_to_comments.rb
=====================================
--- /dev/null
+++ b/db/migrate/20170706154855_add_metadata_to_comments.rb
@@ -0,0 +1,6 @@
+class AddMetadataToComments < ActiveRecord::Migration
+ def change
+ add_column :comments, :metadata, :jsonb, :default => {}
+ add_index :comments, :metadata, using: :gin
+ end
+end
=====================================
db/schema.rb
=====================================
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170614092141) do
+ActiveRecord::Schema.define(version: 20170706154855) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -304,8 +304,10 @@ ActiveRecord::Schema.define(version: 20170614092141) do
t.string "user_agent"
t.string "referrer"
t.text "settings"
+ t.jsonb "metadata", default: {}
end
+ add_index "comments", ["metadata"], name: "index_comments_on_metadata", using: :gin
add_index "comments", ["source_id", "spam"], name: "index_comments_on_source_id_and_spam", using: :btree
create_table "contact_lists", force: :cascade do |t|
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/1c9ce1e63d8d25e2d75694f4d04ef95895720bf4
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/1c9ce1e63d8d25e2d75694f4d04ef95895720bf4
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170707/1d9957bc/attachment-0001.html>
More information about the Noosfero-dev
mailing list