-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add in missing publication tables (#2132)
* chore: fix flaky schema check * Revert "fix: reduce exit trapping and error logging on supervision tree termination" This reverts commit e2fb447. * chore: resolve flaky tests, remove unnecessary exit trapping * fix: add in missing publication tables * fix: recreate missing publication tables * fix: don't drop anything on down * chore: formatting * fix: don't allow publication tables to change between migrations * fix: config reference
- Loading branch information
Showing
4 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
priv/repo/migrations/20240708025030_recreate_publication_for_tables.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
defmodule Logflare.Repo.Migrations.RecreatePublicationForTables do | ||
use Ecto.Migration | ||
use Ecto.Migration | ||
|
||
@publications Application.get_env(:logflare, Logflare.ContextCache.CacheBuster)[:publications] | ||
@publication_tables [ | ||
"billing_accounts", | ||
"plans", | ||
"rules", | ||
"source_schemas", | ||
"sources", | ||
"users", | ||
"backends", | ||
"team_users" | ||
] | ||
|
||
def up do | ||
for p <- @publications, do: execute("DROP PUBLICATION #{p};") | ||
for p <- @publications do | ||
tables = Enum.join(@publication_tables, ", ") | ||
execute("CREATE PUBLICATION #{p} FOR TABLE #{tables};") | ||
end | ||
end | ||
|
||
def down do | ||
:noop | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters