firxworx
firxworx
DTDrizzle Team
Created by firxworx on 8/26/2023 in #help
Are postgres CONSTRAINTS supported when creating a table schema?
In the column builder types I see there's a general assumption of name, dataType, columnType. In contrast the actual Postgres CREATE TABLE syntax is very rich: https://www.postgresql.org/docs/current/sql-createtable.html Are there ways to support column constraints, table constraints, etc? If a dev has requirements not yet supported by Drizzle, it appears from the docs the use-case is understood (much appreciated!) and the sql template exists for that. However I don't think that sql is supported for generating table schemas or that we can use it with custom type definitions? Is there a way I can still use drizzle schemas and migrations if I need to override some of the generated output to meet the requirements of my schema? If custom types enabled adding constraints that would be really helpful. Its like I can almost do it: if I make a customType() definition return anything other than a one-word string when specifying dataType the generated SQL encapsulates the entire value in double quotes. If it didn't do that, I would be able to return a string that included my type and constraints and be off to the races. That's probably a bit of a hack but it shows a potential path to supporting column constraints: as a property that can be specified when defining a custom type (if they're not already supported and I just don't know how and can't find any docs on it).
2 replies
DTDrizzle Team
Created by firxworx on 8/23/2023 in #help
how to define field w/ postgres IDENTITY?
I am trying Drizzle out for the first time. I thought to flex the quick start with realistic production user table schema. I can't find anywhere (including searching GitHub for examples) how to define the following field??
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
3 replies