Cannot find any primary keys for Table entity
See original GitHub issueHey hey hey! 😃
In case I have a table with a schema like this:
CREATE TABLE `mytable` (
`id` varchar(14) DEFAULT NULL,
`my_uuid` int(11) NOT NULL AUTO_INCREMENT,
`other` varchar(14) DEFAULT NULL,
`my_id` varchar(14) DEFAULT NULL,
`contact` varchar(255) DEFAULT NULL,
`name` varchar(75) DEFAULT NULL,
UNIQUE KEY `display_id` (`my_uuid`),
UNIQUE KEY `name` (`name`),
KEY `mytable_contact` (`contact`),
KEY `mytable_other` (`other`),
KEY `mytable_my_id` (`my_id`)
);
Platformatic will fail with this error:
Error: Cannot find any primary keys for AnonymousCard entity:
at connect (poc-platformatic/node_modules/@platformatic/sql-mapper/mapper.js:120:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async sqlMapper (poc-platformatic/node_modules/@platformatic/sql-mapper/mapper.js:157:18)
Is there a way to skip the constraint that requires a primary key to be defined? 😊
Issue Analytics
- State:
- Created 9 months ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Entity Framework: table without primary key
Some tables do not have primary keys defined so that when I create a new Entity Data Model, I get the following message:...
Read more >Add or change a table's primary key in Access
Select the field or fields that you want to use as the primary key. To select one field, click the row selector for...
Read more >Determining Keys for Tables
If a column permits null values, it cannot be part of a primary key. Some entities have ready-made primary keys such as catalog...
Read more >3 common foreign key mistakes (and how to avoid them)
Foreign key constraints are important to any SQL database, but they can also cause problems if they're not implemented correctly.
Read more >Entity Model generated has all columns in tables marked ...
For what it's worth, I experience something similar to this when adding a View to my EF model. I know views can't have...
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 FreeTop 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
Top GitHub Comments
Tested it right now, and it works smoothly 🙏🏼
That’s what I implemented in https://github.com/platformatic/platformatic/pull/499.