drizzle-team / drizzle-team/drizzle-orm

[BUG]:

Open
#1,031 0 comments 0 reactions 0 assignees View on GitHub
has-pr improvement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.19.10

### What version of `drizzle-kit` are you using?

0.27.2

### Describe the Bug

It seems like it's possible to reference a column from a table even from a field with a different underlying data type. This feels wrong to me.

See the following example:

```
const table1 = sqliteTable("table1", {
id: integer("id").primaryKey(),
});
const table2 = sqliteTable("table2", {
id: integer("id").primaryKey(),
table_1_id: text("table_1_id").references(() => table1.id),
});
```

`table1` is of type integer, but `table_1_id` is of type text, which I would expect to be invalid.

### Expected behavior

I would have expected the return value of `() => table1.id` to be incompatible with `table_1_id`. I've just lost some time to this, and I wish TypeScript had let me know my mistake :)

### Environment & setup

A remix app.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.