laravel-oci8
laravel-oci8 copied to clipboard
use increments when db:seed again insert mistakes because nextval
There are some problems with using laravel-oci8:
Code snippet of problem
When i set id increments,$table->increments('id'); Triggers will be set》》》:begin if :new.id is null then select sys_menu_id_seq.nextval into :new.id from dual; end if; end;《《《 but i need Some places need to specify ID when use db:seed(Because the menu ID needs to be related, I have to specify it.),so When I use it again sys_menu_id_seq.nextval will less than(current DB.id) There will be mistakes. error : ORA-00001: unique constraint (SYS_MENU_MENU_ID_PK) violated So I recommend that you set the last_number of the specified sequence:table.max(id)+1 into :new.id
- Operating System
- PHP 7.1
- Laravel 5.5
- Laravel-OCI8 v5.5.9
So I recommend that you set the last_number of the specified sequence:table.max(id)+1 into :new.id
Thanks but no. I suggest you run a statement that changes the last number of the sequence after seeding.
// do seed
DB::statement('sql to set the last sequence number.')
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.