How to specify data type for database in remult? #219
-
I have a field with more than 255 characters as its content, and I want to use postgres as the database. But when I store this field it will throw |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, The 255 limit compes from If you're using Postgres, I recommend that you'll use the 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({
valueConverter:{
fieldTypeInDb:"the type you want"
}
})
title = "" But if I were you, I use the |
Beta Was this translation helpful? Give feedback.
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 usevarchar
by default that doesn't have that limitationIt'll solve your problem.
If you still want to determine the dbType here's how you can do that :