analytics/priv/repo/migrations/20240307083402_shield_page_rules.exs
hq1 53f94a9f82
Pages shield (#3918)
* Migration: Shield page rules

* Add Ecto schema for Page Rules

* Add Page Rule cache

* Fix typo

* BTW: Use already imported function

* Extend Shields context interface + split existing tests

* Ingestion: filter matching patches + refactor shield actions

* Add LV section for adding Page Rules

* Validate max page path length

* Put Pages Shield behind a feature flag

* Update CHANGELOG

* Update docs link anchor

As per https://github.com/plausible/docs/pull/477

* Update lib/plausible/shields.ex

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>

* Update lib/plausible_web/live/shields/page_rules.ex

Co-authored-by: ruslandoga <doga.ruslan@gmail.com>

* Update lib/plausible_web/live/shields/page_rules.ex

Co-authored-by: ruslandoga <doga.ruslan@gmail.com>

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
Co-authored-by: ruslandoga <doga.ruslan@gmail.com>
2024-03-25 09:48:56 +01:00

18 lines
560 B
Elixir

defmodule Plausible.Repo.Migrations.ShieldPageRules do
use Ecto.Migration
def change do
create table(:shield_rules_page, primary_key: false) do
add(:id, :uuid, primary_key: true)
add :site_id, references(:sites, on_delete: :delete_all), null: false
add :page_path, :text, null: false
add :page_path_pattern, :text, null: false
add :action, :string, default: "deny", null: false
add :added_by, :string
timestamps()
end
create unique_index(:shield_rules_page, [:site_id, :page_path_pattern])
end
end