We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automigrate
drop
model
id
id: true
@property
import {Entity, model, property} from '@loopback/repository'; @model({ settings: { mysql: {table: 'foos'}, forceId: true, } }) export class FooDbEntry extends Entity { @property({ type: 'string', id: true, generated: false, mysql: { columnName: 'foo_id', nullable: 'N' } }) fooId: string; @property({ generated: false, mysql: { columnName: 'bar', nullable: 'Y' } }) bar: string | null; }
autoupdate
The field set as an id inside the model file, is not reflected as a primary key inside the database.
mysql> SHOW KEYS FROM foos WHERE Key_name = 'PRIMARY'; Empty set (0.00 sec)
The field set as an id inside the model file, is reflected as a primary key inside the database.
mysql> SHOW KEYS FROM foos WHERE Key_name = 'PRIMARY'; +--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression | +--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+ | foos | 0 | PRIMARY | 1 | foo_id | A | 211 | NULL | NULL | | BTREE | | | YES | NULL | +--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+ 1 row in set (0.01 sec)
Not applicable due to requirement to connect to MySQL database.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Steps to reproduce
automigrate
-ing bydrop
-ing the database unfeasible).model
's fields set as a anid
, by havingid: true
set in its@property
decorator, like so:autoupdate
set to be executed during startup.Current Behavior
The field set as an
id
inside themodel
file, is not reflected as a primary key inside the database.Actual MySQL query output
Expected Behavior
The field set as an
id
inside themodel
file, is reflected as a primary key inside the database.Expected MySQL query output
Link to reproduction sandbox
Not applicable due to requirement to connect to MySQL database.
The text was updated successfully, but these errors were encountered: