Updates
This commit is contained in:
100
db/schema.rb
100
db/schema.rb
@@ -10,10 +10,56 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2025_11_13_052831) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.bigint "blob_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "name", null: false
|
||||
t.bigint "record_id", null: false
|
||||
t.string "record_type", null: false
|
||||
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
||||
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "active_storage_blobs", force: :cascade do |t|
|
||||
t.bigint "byte_size", null: false
|
||||
t.string "checksum"
|
||||
t.string "content_type"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "filename", null: false
|
||||
t.string "key", null: false
|
||||
t.text "metadata"
|
||||
t.string "service_name", null: false
|
||||
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||
end
|
||||
|
||||
create_table "active_storage_variant_records", force: :cascade do |t|
|
||||
t.bigint "blob_id", null: false
|
||||
t.string "variation_digest", null: false
|
||||
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "data_imports", force: :cascade do |t|
|
||||
t.datetime "completed_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.text "error_message"
|
||||
t.integer "failed_records", default: 0
|
||||
t.string "filename", null: false
|
||||
t.json "import_stats", default: {}, comment: "Detailed import statistics"
|
||||
t.string "import_type", null: false, comment: "ASN or Country import"
|
||||
t.integer "processed_records", default: 0
|
||||
t.datetime "started_at"
|
||||
t.string "status", default: "pending", null: false, comment: "pending, processing, completed, failed"
|
||||
t.integer "total_records", default: 0
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["created_at"], name: "index_data_imports_on_created_at"
|
||||
t.index ["import_type"], name: "index_data_imports_on_import_type"
|
||||
t.index ["status"], name: "index_data_imports_on_status"
|
||||
end
|
||||
|
||||
create_table "dsns", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.boolean "enabled", default: true, null: false
|
||||
@@ -26,13 +72,21 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
create_table "events", force: :cascade do |t|
|
||||
t.string "agent_name"
|
||||
t.string "agent_version"
|
||||
t.integer "asn"
|
||||
t.string "asn_org"
|
||||
t.text "blocked_reason"
|
||||
t.string "company"
|
||||
t.string "country"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "environment"
|
||||
t.string "event_id", null: false
|
||||
t.inet "ip_address"
|
||||
t.boolean "is_datacenter", default: false, null: false
|
||||
t.boolean "is_proxy", default: false, null: false
|
||||
t.boolean "is_vpn", default: false, null: false
|
||||
t.bigint "network_range_id"
|
||||
t.json "payload"
|
||||
t.bigint "request_host_id"
|
||||
t.string "request_id", null: false
|
||||
t.integer "request_method", default: 0
|
||||
t.string "request_path"
|
||||
t.string "request_protocol"
|
||||
@@ -40,17 +94,25 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.string "request_url"
|
||||
t.integer "response_status"
|
||||
t.integer "response_time_ms"
|
||||
t.string "rule_matched"
|
||||
t.bigint "rule_id"
|
||||
t.string "server_name"
|
||||
t.jsonb "tags", default: [], null: false
|
||||
t.datetime "timestamp", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "user_agent"
|
||||
t.integer "waf_action", default: 0, null: false
|
||||
t.index ["event_id"], name: "index_events_on_event_id", unique: true
|
||||
t.index ["asn"], name: "index_events_on_asn"
|
||||
t.index ["company"], name: "index_events_on_company"
|
||||
t.index ["country"], name: "index_events_on_country"
|
||||
t.index ["ip_address"], name: "index_events_on_ip_address"
|
||||
t.index ["is_datacenter", "is_vpn", "is_proxy"], name: "index_events_on_network_flags"
|
||||
t.index ["network_range_id"], name: "index_events_on_network_range_id"
|
||||
t.index ["request_host_id", "request_method", "request_segment_ids"], name: "idx_events_host_method_path"
|
||||
t.index ["request_host_id"], name: "index_events_on_request_host_id"
|
||||
t.index ["request_id"], name: "index_events_on_request_id", unique: true
|
||||
t.index ["request_segment_ids"], name: "index_events_on_request_segment_ids"
|
||||
t.index ["rule_id"], name: "index_events_on_rule_id"
|
||||
t.index ["tags"], name: "index_events_on_tags", using: :gin
|
||||
t.index ["timestamp"], name: "index_events_on_timestamp"
|
||||
t.index ["waf_action"], name: "index_events_on_waf_action"
|
||||
end
|
||||
@@ -70,6 +132,8 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.boolean "is_vpn", default: false
|
||||
t.datetime "last_api_fetch"
|
||||
t.inet "network", null: false
|
||||
t.jsonb "network_data", default: {}
|
||||
t.datetime "policies_evaluated_at"
|
||||
t.string "source", default: "api_imported", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "user_id"
|
||||
@@ -82,6 +146,8 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.index ["is_datacenter"], name: "index_network_ranges_on_is_datacenter"
|
||||
t.index ["network"], name: "index_network_ranges_on_network", opclass: :inet_ops, using: :gist
|
||||
t.index ["network"], name: "index_network_ranges_on_network_unique", unique: true
|
||||
t.index ["network_data"], name: "index_network_ranges_on_network_data", using: :gin
|
||||
t.index ["policies_evaluated_at"], name: "index_network_ranges_on_policies_evaluated_at"
|
||||
t.index ["source"], name: "index_network_ranges_on_source"
|
||||
t.index ["user_id"], name: "index_network_ranges_on_user_id"
|
||||
end
|
||||
@@ -126,7 +192,6 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
end
|
||||
|
||||
create_table "rules", force: :cascade do |t|
|
||||
t.string "action", null: false
|
||||
t.json "conditions", default: {}
|
||||
t.datetime "created_at", null: false
|
||||
t.boolean "enabled", default: true, null: false
|
||||
@@ -134,24 +199,28 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.json "metadata", default: {}
|
||||
t.bigint "network_range_id"
|
||||
t.integer "priority"
|
||||
t.string "rule_type", null: false
|
||||
t.string "source", limit: 100, default: "manual"
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "user_id"
|
||||
t.integer "waf_action", default: 0, null: false
|
||||
t.bigint "waf_policy_id"
|
||||
t.index ["action"], name: "index_rules_on_action"
|
||||
t.integer "waf_rule_type", default: 0, null: false
|
||||
t.index ["enabled", "expires_at"], name: "idx_rules_active"
|
||||
t.index ["enabled"], name: "index_rules_on_enabled"
|
||||
t.index ["expires_at"], name: "index_rules_on_expires_at"
|
||||
t.index ["network_range_id", "waf_action", "waf_policy_id", "expires_at"], name: "index_rules_on_network_policy_expires_unique", unique: true, where: "(((source)::text = 'policy'::text) AND (expires_at IS NOT NULL))"
|
||||
t.index ["network_range_id", "waf_action", "waf_policy_id"], name: "index_rules_on_network_policy_unique", unique: true, where: "(((source)::text = 'policy'::text) AND (expires_at IS NULL))"
|
||||
t.index ["network_range_id"], name: "index_rules_on_network_range_id"
|
||||
t.index ["priority"], name: "index_rules_on_priority"
|
||||
t.index ["rule_type", "enabled"], name: "idx_rules_type_enabled"
|
||||
t.index ["rule_type"], name: "index_rules_on_rule_type"
|
||||
t.index ["source", "expires_at"], name: "index_rules_on_source_expires"
|
||||
t.index ["source"], name: "index_rules_on_source"
|
||||
t.index ["updated_at", "id"], name: "idx_rules_sync"
|
||||
t.index ["user_id"], name: "index_rules_on_user_id"
|
||||
t.index ["waf_action"], name: "index_rules_on_waf_action"
|
||||
t.index ["waf_policy_id", "expires_at"], name: "index_rules_on_policy_expires"
|
||||
t.index ["waf_policy_id"], name: "idx_rules_waf_policy"
|
||||
t.index ["waf_policy_id"], name: "index_rules_on_waf_policy_id"
|
||||
t.index ["waf_rule_type"], name: "index_rules_on_waf_rule_type"
|
||||
end
|
||||
|
||||
create_table "sessions", force: :cascade do |t|
|
||||
@@ -163,6 +232,14 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.index ["user_id"], name: "index_sessions_on_user_id"
|
||||
end
|
||||
|
||||
create_table "settings", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "key"
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "value"
|
||||
t.index ["key"], name: "index_settings_on_key", unique: true
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "email_address", null: false
|
||||
@@ -173,13 +250,13 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
end
|
||||
|
||||
create_table "waf_policies", force: :cascade do |t|
|
||||
t.string "action", default: "deny", null: false
|
||||
t.json "additional_data", default: {}
|
||||
t.datetime "created_at", null: false
|
||||
t.text "description"
|
||||
t.boolean "enabled", default: true, null: false
|
||||
t.datetime "expires_at"
|
||||
t.string "name", null: false
|
||||
t.string "policy_action", default: "deny", null: false
|
||||
t.string "policy_type", default: "country", null: false
|
||||
t.json "targets", default: []
|
||||
t.datetime "updated_at", null: false
|
||||
@@ -191,7 +268,10 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_10_023232) do
|
||||
t.index ["user_id"], name: "index_waf_policies_on_user_id"
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "events", "request_hosts"
|
||||
add_foreign_key "events", "rules"
|
||||
add_foreign_key "network_ranges", "users"
|
||||
add_foreign_key "rules", "network_ranges"
|
||||
add_foreign_key "rules", "users"
|
||||
|
||||
Reference in New Issue
Block a user