Replies: 2 comments
-
I got the same issue like this. But in my case, I used |
Beta Was this translation helpful? Give feedback.
-
With So, when you go to insert another record after your seeder, the sequence is still trying to insert a record with the id of 1, since it hasn't been updated, as noted in this line of the error If you omit the manually defined id on your seeder const usersData = [
{
// id: 1, 👈 let the database set the id
first_name: 'Super',
last_name: 'Admin',
email: '[email protected]',
mobile_number: '01234567890',
password: superAdminPassword,
user_role_id: 1,
is_active: true,
is_deleted: false,
},
{
// id: 2, 👈 let the database set the id
first_name: 'Customer',
last_name: 'User',
email: '[email protected]',
mobile_number: '08098273638',
password: otherUserPassword,
user_role_id: 3,
is_active: true,
is_deleted: false,
},
]``` |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Whenever I tried to create a new record after running seed, I get a duplicate record.
This happens when I ran fresh migrations and seed some data.
So I have two existing seeded records when I tried to create the new record; I get the duplicate error.
However when I tried registering the third time the record got created and there was no error.
Migration and Seed works perfectly
UserSeeder.ts
Method to create User
I dont know if this is a bug or if I am doing. something wrong
Beta Was this translation helpful? Give feedback.
All reactions