Skip to content

How to specify data type for database in remult? #219

Answered by noam-honig
CKylinMC asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

The 255 limit compes from knex

If you're using Postgres, I recommend that you'll use the remult/postgres data provider, it would use varchar by default that doesn't have that limitation

import express from "express"
import { remultExpress } from "remult/remult-express"
import { createPostgresConnection } from "remult/postgres"

const app = express()

const connectionString = "postgres://user:password@host:5432/database"

app.use(
  remultExpress({
    dataProvider:
      createPostgresConnection({
        connectionString // default: process.env["DATABASE_URL"]
      })
  })
)

It'll solve your problem.

If you still want to determine the dbType here's how you can do that :

@Fields.string(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CKylinMC
Comment options

Answer selected by CKylinMC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants