feat: IP lookup (#1315)

- feature to store contact IP for accounts
- IP lookup through geocoder gem
- ability to do IP lookup through external APIs
- add commit hook to prevent push to develop and master
- migrations to fix default values for jsonb columns
This commit is contained in:
Sojan Jose
2020-10-28 02:14:36 +05:30
committed by GitHub
parent ff96d43953
commit 1d9debaee0
16 changed files with 163 additions and 9 deletions

View File

@@ -0,0 +1,8 @@
class AddDefaultValueToJsonbColums < ActiveRecord::Migration[6.0]
def change
change_column_default :contacts, :additional_attributes, from: nil, to: {}
change_column_default :conversations, :additional_attributes, from: nil, to: {}
change_column_default :installation_configs, :serialized_value, from: '{}', to: {}
change_column_default :notification_subscriptions, :subscription_attributes, from: '{}', to: {}
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_10_11_152227) do
ActiveRecord::Schema.define(version: 2020_10_19_173944) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -203,7 +203,7 @@ ActiveRecord::Schema.define(version: 2020_10_11_152227) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "pubsub_token"
t.jsonb "additional_attributes"
t.jsonb "additional_attributes", default: {}
t.string "identifier"
t.jsonb "custom_attributes", default: {}
t.index ["account_id"], name: "index_contacts_on_account_id"
@@ -224,7 +224,7 @@ ActiveRecord::Schema.define(version: 2020_10_11_152227) do
t.datetime "contact_last_seen_at"
t.datetime "agent_last_seen_at"
t.boolean "locked", default: false
t.jsonb "additional_attributes"
t.jsonb "additional_attributes", default: {}
t.bigint "contact_inbox_id"
t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false
t.string "identifier"
@@ -285,7 +285,7 @@ ActiveRecord::Schema.define(version: 2020_10_11_152227) do
create_table "installation_configs", force: :cascade do |t|
t.string "name", null: false
t.jsonb "serialized_value", default: "{}", null: false
t.jsonb "serialized_value", default: {}, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["name", "created_at"], name: "index_installation_configs_on_name_and_created_at", unique: true
@@ -399,7 +399,7 @@ ActiveRecord::Schema.define(version: 2020_10_11_152227) do
create_table "notification_subscriptions", force: :cascade do |t|
t.bigint "user_id", null: false
t.integer "subscription_type", null: false
t.jsonb "subscription_attributes", default: "{}", null: false
t.jsonb "subscription_attributes", default: {}, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "identifier"
@@ -452,9 +452,11 @@ ActiveRecord::Schema.define(version: 2020_10_11_152227) do
t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy"
t.index ["taggable_id"], name: "index_taggings_on_taggable_id"
t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable_type_and_taggable_id"
t.index ["taggable_type"], name: "index_taggings_on_taggable_type"
t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type"
t.index ["tagger_id"], name: "index_taggings_on_tagger_id"
t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger_type_and_tagger_id"
end
create_table "tags", id: :serial, force: :cascade do |t|