Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bugfix/1547-respo…
Browse files Browse the repository at this point in the history
…nsive-welcome
  • Loading branch information
DKurilo committed Oct 18, 2022
2 parents 240b5e8 + 85c5123 commit 4ba5db7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
17 changes: 13 additions & 4 deletions IHP/IDE/SchemaDesigner/Controller/Migrations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ instance Controller MigrationsController where
setSuccessMessage ("Migration generated: " <> path)
openEditor path 0 0
else do
migrateAppDB revision

clearDatabaseNeedsMigration
result <- Exception.try (migrateAppDB revision)
case result of
Left (exception :: SomeException) -> do
let errorMessage = case fromException exception of
Just (exception :: EnhancedSqlError) -> cs exception.sqlError.sqlErrorMsg
Nothing -> tshow exception

setErrorMessage errorMessage
redirectTo MigrationsAction
Right _ -> do
clearDatabaseNeedsMigration
redirectTo MigrationsAction

redirectTo MigrationsAction

Expand Down Expand Up @@ -98,7 +107,7 @@ instance Controller MigrationsController where
case result of
Left (exception :: SomeException) -> do
let errorMessage = case fromException exception of
Just (exception :: EnhancedSqlError) -> cs $ get #sqlErrorMsg (get #sqlError exception)
Just (exception :: EnhancedSqlError) -> cs exception.sqlError.sqlErrorMsg
Nothing -> tshow exception

setErrorMessage errorMessage
Expand Down
23 changes: 17 additions & 6 deletions NixSupport/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, additionalNixpkgsOptions ? {}
, postgresExtensions ? (p: [])
, optimized ? false
, includeDevTools ? !optimized # Include Haskell Language Server and Postgres?
}:

let
Expand All @@ -16,9 +17,14 @@ let
(if withHoogle
then ghc.ghcWithHoogle
else ghc.ghcWithPackages)
(p: builtins.concatLists [ [p.haskell-language-server] (haskellDeps p) ] );
allNativePackages = builtins.concatLists [ (otherDeps pkgs)
[(pkgs.postgresql_13.withPackages postgresExtensions) pkgs.makeWrapper] (if pkgs.stdenv.isDarwin then [] else []) ];
(p: builtins.concatLists [
(if includeDevTools then [p.haskell-language-server] else [])
(haskellDeps p)
]
);
allNativePackages = builtins.concatLists [
(otherDeps pkgs)
];

appBinary = if optimized
then "build/bin/RunOptimizedProdServer"
Expand Down Expand Up @@ -47,18 +53,18 @@ in
# See https://github.com/svanderburg/node2nix/issues/217#issuecomment-751311272
export HOME=/tmp
make ${appBinary}
make -j ${appBinary}
# Build job runner if there are any jobs
if find -type d -iwholename \*/Job|grep .; then
make ${jobsBinary};
make -j ${jobsBinary};
fi;
# Build all scripts if there are any
mkdir -p Application/Script
SCRIPT_TARGETS=`find Application/Script -type f -iwholename '*.hs' -not -name 'Prelude.hs' -exec basename {} .hs ';' | sed 's#^#build/bin/Script/#' | tr "\n" " "`
if [[ ! -z "$SCRIPT_TARGETS" ]]; then
make $SCRIPT_TARGETS;
make -j $SCRIPT_TARGETS;
fi;
'';
installPhase = ''
Expand Down Expand Up @@ -90,5 +96,10 @@ in
dontFixup = true;
src = (import <nixpkgs> {}).nix-gitignore.gitignoreSource [] projectPath;
buildInputs = builtins.concatLists [ [allHaskellPackages] allNativePackages ];
nativeBuildInputs = builtins.concatLists [
[ pkgs.makeWrapper ]
(if includeDevTools then [(pkgs.postgresql_13.withPackages postgresExtensions)] else [])
];
shellHook = "eval $(egrep ^export ${allHaskellPackages}/bin/ghc)";
enableParallelBuilding = true;
}

0 comments on commit 4ba5db7

Please sign in to comment.