Git Product home page Git Product logo

digitallyinduced / ihp Goto Github PK

View Code? Open in Web Editor NEW
4.2K 35.0 187.0 53.61 MB

🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness

Home Page: https://ihp.digitallyinduced.com/

License: MIT License

Haskell 90.38% Nix 1.90% Shell 0.42% Makefile 0.11% HTML 0.60% CSS 1.46% JavaScript 4.80% Python 0.30% PLpgSQL 0.02%
haskell postgresql nix mvc html framework hacktoberfest

ihp's People

Contributors

agreif avatar alexander-block avatar amitaibu avatar andreasrueb avatar aronnovak avatar cschank avatar dharmatech avatar eisfunke avatar fegu avatar garrisonj avatar hendi avatar hllizi avatar hugopeters1024 avatar jeyj0 avatar kodefant avatar laobiz avatar lipranu avatar montmorency avatar mpscholten avatar nezbite avatar nghamilton avatar oclbdk avatar pauldub avatar rametta avatar ruhatch avatar rvarun11 avatar s0kil avatar themmes avatar unhammer avatar zacwood9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ihp's Issues

ihp-new should check if git and gnumake are installed

To ensure a smooth install experience ihp-new should ensure that git and gnumake are installed.

In my opinion it does not make sense to check for curl as it is used in the installation of nix which is necessary for the beginning of the installation.

postgres not initialising

Hi there.

very cool project.
I've tried to set it up like it says on the guide, but the postgres db doesn't start.
http://localhost:8001/PostgresLogs

postgres: could not access directory "/run/media/antouank/blog/build/db/state": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.

logs from terminal when I run "./start"

blog ./start
direnv: loading /run/media/antouank/blog/.envrc
direnv: export ~PATH
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help
package flags have changed, resetting and loading new packages...
Warning: -debug, -threaded and -ticky are ignored by GHCi
package flags have changed, resetting and loading new packages...
Loaded GHCi configuration from /run/media/antouank/blog/.ghci
Prelude> package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
Prelude> Prelude ClassyPrelude> [1 of 6] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )
[2 of 6] Compiling Config           ( Config/Config.hs, interpreted )
[3 of 6] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )
[4 of 6] Compiling Web.Types        ( Web/Types.hs, interpreted )
[5 of 6] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )
[6 of 6] Compiling Main             ( Main.hs, interpreted )
Ok, six modules loaded.

runing manjaro arch and used nix to install it

➜  blog uname -ar
Linux styx 5.6.19-2-MANJARO #1 SMP PREEMPT Wed Jun 17 22:24:52 UTC 2020 x86_64 GNU/Linux
➜  blog nix --version
nix (Nix) 2.3.6

Improve Not Found Error Handling

Right now the Not Found error messages e.g. when an entity cannot be found by a fetch are not so helpful.

In dev mode, the error message should show e.g. the sql query which results in the error. Additionally functions like fetchOneOrNothing should be suggested.

We should also introduce a NotFoundException which can be raised by all functions dealing with not founds. Right now these functions all call error. Throwing a NotFoundException should result in a 404 error response (we should allow the user to customize the 404 page of course :) ).

https://app.clubhouse.io/digitallyinduced/story/728/fehlermeldung-verbessern-cannot-find-model

How to cross JS language barrier

I can't find this in the documentation. But I would like to call JS function (normal and async functions) from within ihp. Mainly to leverage the huge number of existing JavaScript libraries and also to call into the browser API's like file reading, local storage etc.

If this is possible could you provide an example or link to documentation on how I can achieve this?

Required form fields

Given how common required form fields are, https://ihp.digitallyinduced.com/Guide/form.html should have a section on how to denote required fields, i.e. add the required attribute:

{(textField #title) { fieldInput = (\fieldInput -> H.input ! A.required "required") }}

Also it'd be nice to have the common attribute required easily available, without requiring two imports and a lambda.

How to update IHP?

The documentation should have instructions about how to update a project's IHP version.

  • How to update to the latest release
  • How to update to the latest git commit
  • How to use a specific git commit

Compilation breaks generating Controller for model with Double

Hi, its me again trying to push forward a model containing floats ;-)!

Steps to reproduce

  1. ihp-new test
  2. cd test and ./start
  3. create new table in schema designer, add column, select datatype Double
  4. update and push to db
  5. create new codegen/Controller

Expected

Successful compilation similar to the example with "Posts"

Bug

received Compilation error particularly for the field with datatype Double. This apparently does not work with the signature of 'textField'

Web/View/Products/Edit.hs:19:43: error:
    • Could not deduce (InputValue Double)
        arising from a use of ‘textField’
      from the context: ?viewContext::ViewContext
        bound by the type signature for:
                   renderForm :: Product -> Html
        at Web/View/Products/Edit.hs:(19,1)-(25,2)
      or from: (?viewContext::ViewContext,
                ?formContext::FormContext Product)
        bound by a type expected by the context:
                   (?viewContext::ViewContext, ?formContext::FormContext Product) =>
                   Text.Blaze.Html.Html
        at Web/View/Products/Edit.hs:(19,38)-(25,2)
    • In the first argument of ‘toHtml’, namely
        ‘(textField (fromLabel @"price"))’
      In the expression: toHtml (textField (fromLabel @"price"))
      In the third argument of ‘Data.MonoTraversable.Unprefixed.foldl'’, namely
        ‘[toHtml (textField (fromLabel @"category")),
          toHtml (textField (fromLabel @"title")),
          toHtml (textField (fromLabel @"description")),
          toHtml (textField (fromLabel @"price")), ....]’
   |
19 | renderForm product = formFor product [hsx|
   |       

Codegenerator check if name exists

Running the codegenerator for a second time does not check for name uniqueness.

What happens is it:

  • for files where it appends, it appends more code
  • for new files, it overwrites entire file

Preferably, it should warn that this name already exists. If the warning is ignored, I would expect to overwrite in both cases.

Auto fix for not existing app database.

If there was an error in a prior start of the Dev Server the database app does not exist and the dev server will not start.

We should check for this case and automatically create the app database through createdb.

Compilation breaks when selecting Float in Schema designer

First of thanks, for building such a great piece of software. Its a nice opportunity for me to dive into Haskell! Then considering my little experience with Haskell you might need to take this issue with a grain of salt.

Steps to reproduce

  1. ihp-new test
  2. cd test and ./start
  3. create new table in schema designer, add column, select datatype Float
  4. update and push to db

Expected

succesfull compilation

Bug

received Compilation error, it seems selecting Float does map to REAL, but that in turn does not map back to the Float Haskell type.

I think this can be fixed by adding altering the IHP/SchemaCompiler.hs, where it says "FLOAT" -> "Float" which probably should be "REAL" -> "Float"

Schema Designer: Push DB is not handling errors

When an errors happens while running make db, the error should be shown. Right now it just fails silently and data might be missing (e.g. when the fixtures don't match the new database schema)

ENUM with DEFAULT NULL

  • Create an enum
  • Create a nullable field that uses this enum
  • Create a controller

Compilation fails with

build/Generated/Types.hs:156:132: error: parse error on input `='
    |
156 |     fromField field (Just value) = returnError ConversionFailed field "Unexpected value for enum value"    fromField field Nothing = returnError UnexpectedNull field "Unexpected null for enum value"

Error installing Nix in Mac with FileVaut encrypted volumes

Following the install guide executed: sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume then it returned: error: refusing to create Nix store volume because the boot volume is FileVault encrypted, but encryption-at-rest is not available. Manually create a volume for the store and re-run this script. See https://nixos.org/nix/manual/#sect-macos-installation

"No instance for (Default ...) arising from a use of 'def'" errors on editing schema

After creating the first table in the schema editor, I see Default-related errors:

~/src$ ihp-new paste2

Updating build/Generated/Types.hs
Application created in Web
🚀 Project created, happy coding :)
You can start the server by running:
  cd paste2
  ./start
~/src$ cd paste2
~/src/paste2$ ./start
direnv: loading ~/src/paste2/.envrc
direnv: export ~PATH
The files belonging to this database system will be owned by user "simon".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory build/db/state ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... America/Los_Angeles
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D build/db/state -l logfile start

Loaded package environment from /Users/simon/.ghc/x86_64-darwin-8.8.3/environments/default
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help
Warning: -debug, -threaded and -ticky are ignored by GHCi
Pager usage is off.
CREATE EXTENSION
Pager usage is off.
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
Loaded GHCi configuration from /Users/simon/src/paste2/.ghci
Loaded GHCi configuration from /Users/simon/.ghci
Prelude> package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
Prelude> Prelude ClassyPrelude> [1 of 6] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )
[2 of 6] Compiling Config           ( Config/Config.hs, interpreted )
[3 of 6] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )
[4 of 6] Compiling Web.Types        ( Web/Types.hs, interpreted )
[5 of 6] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )
[6 of 6] Compiling Main             ( Main.hs, interpreted )
Ok, six modules loaded.
*Main Prelude ClassyPrelude> *Main Prelude ClassyPrelude> Server started
./start
Updating build/Generated/Types.hs
*Main Prelude ClassyPrelude> [3 of 6] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )

build/Generated/Types.hs:31:83: error:
    • No instance for (Default MetaBag) arising from a use of ‘def’
    • In the first argument of ‘pure’, namely ‘def’
      In the second argument of ‘(<*>)’, namely ‘pure def’
      In a stmt of a 'do' block: Paste <$> pure id <*> pure def
   |
Failed, two modules loaded.
31 | instance FromRow Paste where fromRow = do id <- field; Paste <$> pure id <*> pure def;
   |                                                                                   ^^^

build/Generated/Types.hs:53:23: error:
    • No instance for (Default (Id' "pastes"))
        arising from a use of ‘def’
    • In the first argument of ‘Paste’, namely ‘def’
      In the expression: Paste def def
      In an equation for ‘newRecord’: newRecord = Paste def def
   |
53 |     newRecord = Paste def  def
   |                       ^^^

build/Generated/Types.hs:53:28: error:
    • No instance for (Default MetaBag) arising from a use of ‘def’
    • In the second argument of ‘Paste’, namely ‘def’
      In the expression: Paste def def
      In an equation for ‘newRecord’: newRecord = Paste def def
   |
53 |     newRecord = Paste def  def
   |                            ^^^

Accessing currentUser in template fails

According to the documentation, the following should work:
image

instance View IndexView ViewContext where
    html IndexView { .. } = [hsx|
        <nav>           
            <ol class="breadcrumb">
                <li class="breadcrumb-item active"><a href={BuildingsAction}>Buildings</a></li>
            </ol>
        </nav>
        <h1>Hello {get #name currentUser}</h1>
        <h1>Buildings <a href={pathTo NewBuildingAction} class="btn btn-primary ml-4">+ New</a></h1>
    |]

But it doesn't:

Web/View/Buildings/Index.hs:7:34: error:
    * Overlapping instances for IHP.HtmlSupport.ToHtml.ToHtml a0
        arising from a use of `toHtml'
      Matching instances:
        instance [overlappable] Show a => IHP.HtmlSupport.ToHtml.ToHtml a
          -- Defined in `IHP.HtmlSupport.ToHtml'
        instance IHP.HtmlSupport.ToHtml.ToHtml ByteString
          -- Defined in `IHP.HtmlSupport.ToHtml'
        instance IHP.HtmlSupport.ToHtml.ToHtml Text
          -- Defined in `IHP.HtmlSupport.ToHtml'
        ...plus two others
        ...plus two instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)
      (The choice depends on the instantiation of `a0'
       To pick the first instance above, use IncoherentInstances
       when compiling the other instance declarations)
    * In the expression: toHtml ((get (fromLabel @"name")) currentUser)
      In the second argument of `IHP.HtmlSupport.QQ.makeElement', namely
        `[Text.Blaze.Internal.string "Hello ",
          toHtml ((get (fromLabel @"name")) currentUser)]'
      In the first argument of `IHP.HtmlSupport.QQ.applyAttributes', namely
        `((IHP.HtmlSupport.QQ.makeElement (Data.Text.pack "h1"))
            [Text.Blaze.Internal.string "Hello ",
             toHtml ((get (fromLabel @"name")) currentUser)])'
  |
7 |     html IndexView { .. } = [hsx|
  |                                  ^...

Possible to make Nix a non-requirement?

This project looks great, so happy to see this and happy that digitally induced is standing behind it.
A huge thanks for creating it!

I would like to try it out for myself over weekends, but there is a stumbling block I have at the moment.

As a Mac user, for many reasons I am hesitant to install Nix on my Mac; Windows users may feel they have it even worse.
I know the project itself is built using Nix, and I have no objections to it being that way, of course.

However, I would like to explore whether there are any possible paths to take to make it even more accessible to a wider community of people who use Haskell, but not Nix, as well as people who just want to get into Haskell but for whom Nix might be an overkill. It could be a stumbling block for potentially many people.

I am not sure whether you have any plans of offering it on Hackage, and I won't object much if you say the answer to that is no, but I believe there might be some alternative ways to not to have Nix be a hard requirement and I think many other people will agree with me and be able to offer even better suggestions than me.

Personally, for me, even if it is a simple shell script that downloads the project and installs any necessary dependencies would probably be a big boost.

P.S. I am willing to contribute anything in terms of developer time and assistance in my free time if you guys think this is possible.

Recipe: How to make a http request

Should describe on how you can make a http request to an external web service in the most simple way.

[Removed internal clubhouse link]

Bigint Primary Keys

Right now IHP only supports UUID PKs. We should add support for Bigint or Int PKs to improve the experience for people transition to IHP from other frameworks

"could not load module" errors at startup

Thank you, this is awesome!

But I hit trouble while following correct (I believe) install procedure, on a mac:

...
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /Users/simon/.ghc/x86_64-darwin-8.8.3/environments/default
Warning: -debug, -threaded and -ticky are ignored by GHCi
package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
Loaded GHCi configuration from /Users/simon/src/blog/.ghci
Loaded GHCi configuration from /Users/simon/.ghci
Prelude> package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...

<no location info>: error:
    Could not load module ‘ClassyPrelude’
    It is a member of the hidden package ‘classy-prelude-1.5.0’.
    You can run ‘:set -package classy-prelude’ to expose it.
    (Note: this unloads all the modules in the current scope.)
Prelude> Prelude> [1 of 6] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )
[2 of 6] Compiling Config           ( Config/Config.hs, interpreted )

[3 of 6] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )
build/Generated/Types.hs:7:1: error:
    Could not load module ‘CorePrelude’
    It is a member of the hidden package ‘basic-prelude-0.7.0’.
    You can run ‘:set -package basic-prelude’ to expose it.
    (Note: this unloads all the modules in the current scope.)
Failed, two modules loaded.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
7 | import CorePrelude hiding (id) 
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

Compilation breaks when using a DATE type

build/Generated/Types.hs:306:137: error:
    Not in scope: type constructor or class `Date'
    Perhaps you meant `Data' (imported from Data.Data)
    |
306 | data Lease' tenant_id property_id rents = Lease {id :: (Id' "leases"), tenantId :: tenant_id, propertyId :: property_id, dateStarted :: Date, dateEnded :: (Maybe Date), rents :: rents, meta :: MetaBag} deriving (Eq, Show)
    | 

column autofill overwrites user-selected values

This might be wanted behavior, however I think there's a better way to handle it.

Steps to reproduce

  1. Open DevTools
  2. Goto Schema
  3. Select a Table / Create a Table
  4. Click on "New Column"
  5. select a type and default value
  6. enter (for example) "created_at" as a name

Result: manually selected type and default will be overwritten

Expected behavior

When a field was not changed manually, keep the current behavior.
When a field was changed manually, keep its value. Ideally, display a "suggested value" note next to/under the field.

Fails to build on NixOS 20.03 with default settings

When following the getting started guide and running ihp-new blog, the project is scaffolded as expected and then attempts to build itself. When building, it fails with the following error:

Configuring hspec-discover-2.7.1...
CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1022:20 in Cabal-3.0.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:475:12 in Cabal-3.0.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.0.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.0.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.0.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.0.1.0:Distribution.Simple
  defaultMain, called at Setup.lhs:3:10 in main:Main
Setup: Encountered missing or private dependencies:
hspec-meta >=2.3.2

Steps to reproduce:

  1. nix-env -f https://beta:[email protected]/ihp-new.tar.gz -i ihp-new
  2. idh-new blog or cd blog; nix-build or cd blog; ./start
  3. 💥

The solution that gets me a running app is bumping nixPkgsRev in nixpkgs-config.nix to cd555fdab23426a655746798bd6e253eb8c08bd0, which is the latest revision of nixpkgs as of writing.

I'm relatively new to Haskell in general and would still consider myself a beginner, but here are the steps I tried before bumping nixpkgs:

  1. Adding hspec-meta to haskellDeps in default.nix. This resolves the issue with hspec-meta, but the same error appears but now with case-insensitive -any. Adding case-insensitive also does not change anything.
  2. Adding hspec-meta and case-insensitive to App.cabal.
  3. Changing versions of ihp.

System information:

  • System: NixOS 20.03
  • IHP: 5f6a7e7ca3a3859b7a5319625d945ecc877aa3a6

Building in WSL2 leads to file permission errors

I installed IHP using the Getting Started tutorial provied on the Website.
I'm running it on the Windows Subsystem for Linux (WSL2) with Ubuntu 18.4.
OS: Microsoft Windows 10 Home
OS Version: 10.0.19041 Build 19041

When launching a newly generated Project there is a Permissionissue when creating the database.
Manually creating the folder build/db/state had no effekt, as the existence of this folder prevented init of the db entirely.

From here on it is not possible to follow the "First Project Guide" as i cannot update the database.

To recreate:

  1. Follow these Steps to install for Windows
  2. Make a new Project with ihp-new dummy
  3. Run cd dummy && ./start

Here is the output of start.

I don't now if this matters, but i created the project on a separate HDD, that is not the C-Drive.

./start
direnv: loading /mnt/e/Projects/haskell/dummy/.envrc
direnv: export ~PATH
The files belonging to this database system will be owned by user "ric".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory build/db/state ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default timezone ... Europe/Berlin
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2020-06-25 12:09:43.201 CEST [10350] FATAL:  data directory "/mnt/e/Projects/haskell/dummy/build/db/state" has invalid permissions
2020-06-25 12:09:43.201 CEST [10350] DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing data directory "build/db/state"
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help
Warning: -debug, -threaded and -ticky are ignored by GHCi
*** WARNING: .ghci is writable by someone else, IGNORING!
Suggested fix: execute 'chmod go-w .ghci'
Prelude> package flags have changed, resetting and loading new packages...
package flags have changed, resetting and loading new packages...
> ClassyPrelude> [1 of 6] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )
[2 of 6] Compiling Config           ( Config/Config.hs, interpreted )
[3 of 6] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )
[4 of 6] Compiling Web.Types        ( Web/Types.hs, interpreted )
[5 of 6] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )
[6 of 6] Compiling Main             ( Main.hs, interpreted )
Ok, six modules loaded.
Cannot start app as postgres is not ready yet

Improve Sql Support

Right now IHP doesn't support some major sql features:

  • first remove all comments using sed
  • rename table public.TABLENAME to table TABLENAME
  • removing all table alterations that sets the owner
  • changed all "character varying(n)" to TEXT
  • removed all sequences
  • removed "without time zone", "with timezone" for timestamps
  • removed all "create index" lines
  • removed all the intial SET queries
  • removed COMMENT on queries
  • remove adding constraints to tables
  • change "double precision" to "double"

Creating a `nullable` `TEXT` column in the schema editor causes a failure

Creating a nullable TEXT column in the schema editor causes a failure:

toDefaultValueExpr: TEXT column needs to have a TextExpression as default value. Got: VarExpression "NULL"
CallStack (from HasCallStack):
  error, called at ./IHP/SchemaCompiler.hs:429:57 in main:IHP.SchemaCompiler
CREATE TABLE NullFails (
    id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
    nullable_field_test TEXT DEFAULT NULL
);

Restarting the build script appears to resolve the problem.

Move View Generation of ControllerGenerator into the ViewGenerator

Right now the IHP.IDE.CodeGen.ControllerGenerator has a generateViews. This function should be fully merged into IHP.IDE.CodeGen.ViewGenerator.

The ViewGenerator does not have special cases for all the CRUD views like EditView. This will be fixed after we have merged the generateViews into the ViewGenerator.

Normalize emails before validating uniqueness

The documentation currently shows misleading/dangerous example code for email uniquess:

image

This misses different case ([email protected] vs. [email protected]) as well as unicode normalization (e.g. ä (U+00E4 latin small letter A with diaeresis) vs a: (U+0041 latin small letter A U+0308 combining diaeresis)

  • Update documentation of validateIsUnique to mention possible pitfalls
  • Provide a normalizeEmail function which can be used with user |> modify #email normalizeEmail |> validateIsUnique #email

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.