File tree Expand file tree Collapse file tree
daikoku/app/fr/maif/daikoku/env Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1836,8 +1836,8 @@ object evolution_1890 extends EvolutionScript {
18361836 | AND NOT EXISTS (
18371837 | SELECT 1
18381838 | FROM apis a
1839- | WHERE (p .content->>'_id' = n.content->'action'->>'api')
1840- | AND p ._deleted = false
1839+ | WHERE (a .content->>'_id' = n.content->'action'->>'api')
1840+ | AND a ._deleted = false
18411841 |);
18421842 |""" .stripMargin
18431843 )
@@ -1940,6 +1940,54 @@ object evolution_1890 extends EvolutionScript {
19401940 }
19411941}
19421942
1943+ object evolution_1891 extends EvolutionScript {
1944+ override def version : String = " 18.9.1"
1945+
1946+ override def script : (
1947+ Option [DatastoreId ],
1948+ DataStore ,
1949+ Materializer ,
1950+ ExecutionContext ,
1951+ OtoroshiClient
1952+ ) => Future [Done ] = {
1953+
1954+ (
1955+ _ : Option [DatastoreId ],
1956+ dataStore : DataStore ,
1957+ _ : Materializer ,
1958+ ec : ExecutionContext ,
1959+ _ : OtoroshiClient
1960+ ) => {
1961+ logger.info(
1962+ s " Begin evolution $version - fix clean orphaned API notifications (18.9.0 hotfix) "
1963+ )
1964+
1965+ given ExecutionContext = ec
1966+
1967+ dataStore.notificationRepo
1968+ .forAllTenant()
1969+ .execute(
1970+ query =
1971+ """
1972+ |DELETE FROM notifications n
1973+ |WHERE n.content->'action'->>'api' IS NOT NULL
1974+ | AND n.content->'action'->>'type' <> 'OtoroshiSyncApiError'
1975+ | AND NOT EXISTS (
1976+ | SELECT 1
1977+ | FROM apis a
1978+ | WHERE (a.content->>'_id' = n.content->'action'->>'api')
1979+ | AND a._deleted = false
1980+ |);
1981+ |""" .stripMargin
1982+ )
1983+ .map { _ =>
1984+ logger.info(s " Evolution $version done " )
1985+ Done
1986+ }
1987+ }
1988+ }
1989+ }
1990+
19431991object evolutions {
19441992 val list : List [EvolutionScript ] =
19451993 List (
@@ -1964,7 +2012,8 @@ object evolutions {
19642012 evolution_1840_b,
19652013 evolution_1840_c,
19662014 evolution_1860,
1967- evolution_1890
2015+ evolution_1890,
2016+ evolution_1891
19682017 )
19692018 def run (
19702019 dataStore : DataStore ,
You can’t perform that action at this time.
0 commit comments