Skip to content

Commit

Permalink
Signed Int readParam bugfix and a few other minor additions
Browse files Browse the repository at this point in the history
  • Loading branch information
fegu committed Nov 13, 2020
1 parent 4262eb2 commit 68afa80
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Guide/installation.markdown
Expand Up @@ -64,7 +64,7 @@ With the Distro downloaded, run it and update it using your package manager. In
```bash
sudo apt update
sudo apt upgrade
sudo apt install git curl make -y
sudo apt install git curl make xdg-utils -y
```

WSL will add your Windows System Paths in your Linux Subsystem. These tend to generate errors due to spaces and brackets in folder names. Also, due to Linux not loading the `.profile`, we need to add the nix.sh manually. To fix these two issues, just add these lines to the end of your `.bashrc`
Expand Down Expand Up @@ -102,6 +102,8 @@ When using Windows, you will be asked if tasks like ghc-iserv or rundevserver sh

Installing nix for IHP was done using [this guide](https://nathan.gs/2019/04/12/nix-on-windows/).

Note that nix can gradually grow to use several GB of disk space, especially after upgrading IHP. You can always run `nix-collect-garbage` in a `nix-shell` which will delete older/unused files.

## 2. Installing IHP

You can now install IHP by running:
Expand Down
4 changes: 2 additions & 2 deletions IHP/Controller/Param.hs
Expand Up @@ -261,7 +261,7 @@ instance ParamReader ByteString where
instance ParamReader Int where
{-# INLINE readParameter #-}
readParameter byteString =
case Attoparsec.parseOnly (Attoparsec.decimal <* Attoparsec.endOfInput) byteString of
case Attoparsec.parseOnly ((Attoparsec.signed Attoparsec.decimal) <* Attoparsec.endOfInput) byteString of
Right value -> Right value
Left error -> Left ("ParamReader Int: " <> cs error)

Expand All @@ -274,7 +274,7 @@ instance ParamReader Int where
instance ParamReader Integer where
{-# INLINE readParameter #-}
readParameter byteString =
case Attoparsec.parseOnly (Attoparsec.decimal <* Attoparsec.endOfInput) byteString of
case Attoparsec.parseOnly ((Attoparsec.signed Attoparsec.decimal) <* Attoparsec.endOfInput) byteString of
Right value -> Right value
Left error -> Left ("ParamReader Int: " <> cs error)

Expand Down
1 change: 1 addition & 0 deletions IHP/IDE/SchemaDesigner/View/Columns/Edit.hs
Expand Up @@ -126,6 +126,7 @@ typeSelector postgresType enumNames = [hsx|
{option selected "Time" "Time"}
{option selected "SERIAL" "Serial"}
{option selected "BIGSERIAL" "Bigserial"}
{option selected "JSONB" "JSON"}
{forEach enumNames renderEnumType}
</select>
|]
Expand Down
6 changes: 6 additions & 0 deletions lib/IHP/static/ihp-schemadesigner.js
Expand Up @@ -67,6 +67,12 @@ function initSchemaDesigner() {
.append(new Option("no default", "", false, false))
.trigger('change');
break;
case "TIMESTAMP WITHOUT TIME ZONE":
$('#defaultSelector').empty()
.append(new Option("NOW()", 'NOW()', true, true))
.append(new Option("no default", "", false, false))
.trigger('change');
break;
case "TEXT":
$('#defaultSelector').empty()
.append(new Option("no default", "", true, true))
Expand Down

0 comments on commit 68afa80

Please sign in to comment.