textYash
Explore posts from serversDTDrizzle Team
•Created by textYash on 4/9/2024 in #help
How to change schema without losing data?
I want to change my schema & add a new field
hidden: boolean("hidden").notNull().default(false),
My current schema looks like:
Now whenever I edit my schema the data from my supabase(postgres) database gets deleted. How can I change the schema while also preserving all the rows in my database??4 replies
DTDrizzle Team
•Created by textYash on 4/1/2024 in #help
How to search the docs for the correct datatype returned by each function?
Since I'm using typescript, quite often I am welcomed by eslint errors. For eample:
Here, how can I specify the datatype for
error
?
The documentation does not specify any types. The documentation only shows examples.4 replies
DTDrizzle Team
•Created by textYash on 3/25/2024 in #help
How to format date?
I tried:
but it does not return an array of objects. How do I get an array of objects from the above query?
Similar to what this statement returns:
12 replies
DTDrizzle Team
•Created by textYash on 3/24/2024 in #help
How to check if an entry already exist?
I found this query to check if an entry in the table already exists:
Which returns the response:
Result(1) [ { exists: false } ]
but how do I use it in a typescript if
statement to run conditional code?10 replies
DTDrizzle Team
•Created by textYash on 3/21/2024 in #help
How to write a good username schema?
I am creating a users table with fields, id, username, email & password. Why do I need to use the id field? Why can't I just use username as the primary key? Would there be any drawbacks to that?
If I use
primaryKey()
then do I need unique().notNull()
?6 replies
DTDrizzle Team
•Created by textYash on 3/19/2024 in #help
How to check schema fields against a regex?
I want to restrict the usernames in my user table with a regex. Basically instagram like criteria for usernames.
This is my current schema:
Is there any method that I can call on this to restrict the username? Something like this:
I know that's nonsense code above, but I'm just trying to convey myself. please don't mind 😅
3 replies