Reference primary keys are not using the imported type
See original GitHub issueHere, the primary key on bar references the primary key on foo
CREATE TABLE foo (id uuid primary key);
CREATE TABLE bar (id uuid primary key references foo(id));
Foo.ts
export type FooId = string & { __flavor?: 'foo' }; ;
export default interface Foo {
/** Primary key. Index: foo_pkey */
id: FooId;
}
export interface FooInitializer {
/** Primary key. Index: foo_pkey */
id: FooId;
}
export const tableName = 'foo'
Bar.ts
import { FooId } from './Foo';
export type BarId = string & { __flavor?: 'bar' };
export default interface Bar {
/** Primary key. Index: bar_pkey */
id: BarId;
}
export interface BarInitializer {
/** Primary key. Index: bar_pkey */
id: BarId;
}
Notice how FooId
is imported, but is not actually used, which causes the typescript compiler to complain.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Primary Key problems when importing - sql - Stack Overflow
I am running into a problem where duplicate keys are found which gives error on import. Specifically, release # "49221" is the value...
Read more >Add Only on an import definition requires a primary key?
The functionality of "Add Only" import type is to add new records. For instance your DE contains 4 records already and now you...
Read more >Primary and Foreign Key Constraints - SQL Server
Primary keys and foreign keys are two types of constraints that can be used to enforce data integrity in SQL Server tables.
Read more >Foreign Key Constraint | CockroachDB Docs
Foreign key columns must use their referenced column's type. ... Using IMPORT INTO will invalidate foreign keys without a VALIDATE CONSTRAINT statement.
Read more >SQL Foreign key - SQLShack
To create a SQL foreign key constraint, the parent table should have primary key column or column with UNIQUE constraint.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah you are right, I was a bit too quick there. Thank you for the explanation. I will try fixing this hopefully soonish 😃
+1