Skip to content
New issue

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

Inserting value for @PrimaryGeneratedColumn() ? #2199

Closed
MarkMatute opened this issue May 23, 2018 · 1 comment · Fixed by #2218, #6199, mattwelke/typeorm-postgres-example#165 or newerton/gobarber-2-backend#17

Comments

@MarkMatute
Copy link

Issue type:

[x] question
[ ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Is there a way to key in custom id for entity?
The code below does work on 0.1.17, does not work on 0.1.18 onwards.

@Entity()
class SampleEntity {

@PrimaryGeneratedColumn()
id: number

@Column()
name: string
}

 return entityManager.create(SampleEntity, {
      id: 100,
      name: 'ABC'
    });
@MarkMatute
Copy link
Author

For the record it works on 0.1.18, 0.1.19, but not on 0.2.0 onwards.
any response for this?

Thanks

bbakhrom added a commit that referenced this issue Mar 18, 2019
dklischies pushed a commit to dklischies/typeorm that referenced this issue Jun 4, 2020
Allow explicit insertion of preset values for mssql IDENTITY columns. These are the equivalent to
auto-incrementing primary keys in MySQL, but require special conditional treatment.

Closes: typeorm#2199 for mssql
dklischies pushed a commit to dklischies/typeorm that referenced this issue Oct 16, 2020
Allow explicit insertion of preset values for mssql IDENTITY columns. These are the equivalent to
auto-incrementing primary keys in MySQL, but require special conditional treatment.

Closes: typeorm#2199 for mssql
dklischies pushed a commit to dklischies/typeorm that referenced this issue Oct 19, 2020
Allow explicit insertion of preset values for mssql IDENTITY columns. These are the equivalent to
auto-incrementing primary keys in MySQL, but require special conditional treatment.

Closes: typeorm#2199 for mssql
pleerock pushed a commit that referenced this issue Feb 8, 2021
Allow explicit insertion of preset values for mssql IDENTITY columns. These are the equivalent to
auto-incrementing primary keys in MySQL, but require special conditional treatment.

Closes: #2199 for mssql

Co-authored-by: Daniel Klischies <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment