nelsonprsousa
nelsonprsousa
Explore posts from servers
DTDrizzle Team
Created by nelsonprsousa on 3/23/2024 in #help
How to alter database with drizzle (sql magic operator)?
Just found what I should use: ${sql.raw(databaseName)} If it helps someone ☝️
2 replies
DTDrizzle Team
Created by nelsonprsousa on 2/27/2024 in #help
How to reference the same table in the table's definition?
Just found the answer, sorry about this post. https://orm.drizzle.team/docs/indexes-constraints#foreign-key
2 replies
CC#
Created by nelsonprsousa on 11/21/2023 in #help
How to let compiler know that List is not null?
That was it, thank you!
6 replies
CC#
Created by nelsonprsousa on 11/21/2023 in #help
How to let compiler know that List is not null?
Note: I know we could use myList!, but that's developer work instead of compiler actually knowing 😇
6 replies
DTDrizzle Team
Created by nelsonprsousa on 11/6/2023 in #help
Foreign key truncated for being too long?
Thank you
3 replies
DTDrizzle Team
Created by nelsonprsousa on 10/27/2023 in #help
How to filter query based on children table?
Do you know why they removed it?
6 replies
DTDrizzle Team
Created by nelsonprsousa on 10/25/2023 in #help
How to run migration script?
Thanks, working like a charm 🙏
8 replies
DTDrizzle Team
Created by nelsonprsousa on 10/25/2023 in #help
How to run migration script?
yeah... such a n00b guy.. sorry I came from C#, all new here 😅
8 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
That was it, thank you!!
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
Checking 🔃
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
Is this expected?
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
No description
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
No description
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
It is using the relations()?
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
Sure. But how can I do it, either way?
17 replies
DTDrizzle Team
Created by nelsonprsousa on 10/24/2023 in #help
How to express "children" or "parent" relation with typescript?
Current schema attempt:
export const countries = pgTable("country", {
id: serial("id").primaryKey().notNull(),
defaultName: varchar("default_name", { length: 50 }).notNull(),
});

export const regions = pgTable("region", {
id: serial("id").primaryKey().notNull(),
defaultName: varchar("default_name", { length: 50 }).notNull(),
countryId: integer("country_id").references(() => countries.id),
});
export const countries = pgTable("country", {
id: serial("id").primaryKey().notNull(),
defaultName: varchar("default_name", { length: 50 }).notNull(),
});

export const regions = pgTable("region", {
id: serial("id").primaryKey().notNull(),
defaultName: varchar("default_name", { length: 50 }).notNull(),
countryId: integer("country_id").references(() => countries.id),
});
17 replies