I’m trying to figure out seeding and related table...
# orm-help
d
I’m trying to figure out seeding and related tables. For instance, what if I want User table to have a field named “state” and I want to allow multiple values for the field. These values would match up to a States table.
Copy code
state: {
    connect: {
        key: “south-carolina”,
        key: “texas”,
        key: “west-virginia”
    }
}
Also, I see relations are required fields. State: [state!]! What if I don’t want that field to be required? I want the user to be able to leave the field blank. Howe do I do that?
h
You can pass an array to connect
Also you can allow nullability in your data model
d
@Harshit How do you make it nullable in the model, if the “key” is required in the State table, and “to-many” relations must not be null.