mirror of
https://github.com/plausible/analytics.git
synced 2024-12-04 03:11:32 +03:00
082ec91c63
* Update depenedencies: OpenAPISpex + cursor based pagination * Update formatter config * Add internal server error implementation * Test errors * Implement pagination interface * Implement Plugins API module macros * Implement Public API base URI (to be used with path helpers once called from within forwarded router's scope) * Implement OpenAPI specs + schemas * Implement Shared Links context module * Add pagination and error views * Add Shared Link view * Implement Shared Link controller * Expose SharedLink.t() spec * Implement separate router for the Plugins API * Update moduledocs * Always wrap resource objects with `data` * Update moduledoc * Use https://github.com/open-api-spex/open_api_spex/pull/425 due to https://github.com/open-api-spex/open_api_spex/issues/92 * Rely on BASE_URL for swagger-ui server definition * Fixup goals migration * Migrate broken goals before deleting dupes * Remove bypassing test rate limiting for which there's none anyway * Move the context module under `Plausible.` namespace * Bring back conn assignment to PluginsAPICase template * Update test/plausible_web/plugins/api/controllers/shared_links_test.exs Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Update renamed aliases * Seed static token for development purposes * Delegate Plugins API 500s to a familiar shape * Simplify with statement --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
30 lines
645 B
Elixir
30 lines
645 B
Elixir
defmodule Plausible.Repo.Migrations.FixBrokenGoals do
|
|
use Ecto.Migration
|
|
|
|
@disable_ddl_transaction true
|
|
@disable_migration_lock true
|
|
|
|
def up do
|
|
execute("""
|
|
UPDATE goals SET page_path = NULL WHERE page_path IS NOT NULL AND event_name IS NOT NULL
|
|
""")
|
|
|
|
execute("""
|
|
ALTER TABLE goals
|
|
ADD CONSTRAINT check_event_name_or_page_path
|
|
CHECK (
|
|
(event_name IS NOT NULL AND page_path IS NULL) OR
|
|
(event_name IS NULL AND page_path IS NOT NULL)
|
|
)
|
|
NOT VALID;
|
|
""")
|
|
end
|
|
|
|
def down do
|
|
execute("""
|
|
ALTER TABLE goals
|
|
DROP CONSTRAINT check_event_name_or_page_path;
|
|
""")
|
|
end
|
|
end
|