Comments (3)
It seems that it is because relation.config is undefined here as is(relation, One)
returns true :
if (is(relation, One) && relation.config) {
return {
fields: relation.config.fields,
references: relation.config.references,
};
}
Actually it doesn't seems to work without adding a config object like this :
export const usersRelations = relations(users, ({ one }) => ({
profileInfo: one(profileInfo, {
fields: [users.id],
references: [profileInfo.userId],
}),
}))
Well not sure if it's a bug or not, but the example is not clear.
from drizzle-orm.
The profileInfo is deleted because you define a ForeignKey with .references(() => users.id, { onDelete: 'cascade' }). So this delete happens on database level.
Please note that according to documentation ForeignKeys and relation definitions work independently of each other. https://orm.drizzle.team/docs/rqb#foreign-keys
from drizzle-orm.
@madisvain ok thanks for this clarification, I tried with all the drizzle-orm 0.29.* version and with the Bun SQLite driver and it's still not working.
from drizzle-orm.
Related Issues (20)
- [BUG]: drizzle-kit push unexpected behaviour HOT 1
- [BUG]: value.getTime is not a function
- [BUG]: TypeError: Cannot read properties of undefined (reading 'primaryKey')
- [FEATURE]: Add ability to use relations in `returning()`
- [BUG]: drizzle-kit does not respect the order of columns configured in primaryKey()
- [BUG]: generate - Contraints changes are not detected HOT 1
- [BUG]: generate with pg_vector - migration produce misspelled string
- [FEATURE]: Fully type-safe query builder
- [FEATURE]: Allow for select statement in insert values clause HOT 1
- [BUG]: db.execute not defined - can't follow documentation
- [BUG]: Incorrect type for array column default value
- [FEATURE]: Create postgresql schema only if not exists
- [BUG]: HOT 5
- [BUG]: Invalid schema generation on postgres instrospect HOT 1
- [BUG]: drizzle-kit introspect TypeError: Cannot read properties of undefined (reading 'toLowerCase') HOT 2
- [BUG]: multiple constraints not added (only the first one is generated) HOT 3
- [BUG]: Relation Query type merges when using the same "with" key
- [BUG]: TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys') HOT 1
- [BUG]: drizzle-kit generate not detecting schema changes HOT 2
- [BUG]: Column conflicts are not getting resolved by drizzle-kit HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drizzle-orm.