I've been trying to use migrations for a cross-dbms database. Using entrust and confide packages, I added migrations after them to add a user_statuses table and a reference in users table to user-statuses' ids; but as I define the foreign key I get this:
[Illuminate\Database\QueryException] Error Code : 2275 Error Message : ORA-02275: such a referential constraint already exists in the table Position : 53 Statement : alter table users add constraint users_state_foreign foreign key ( state ) references user_statuses ( id ) (SQL: alter table users add constraint users_state_foreign foreign key ( state ) references user_statuses ( id )) [yajra\Pdo\Oci8\Exceptions\SqlException] Error Code : 2275 Error Message : ORA-02275: such a referential constraint already exists in the table Position : 53 Statement : alter table users add constraint users_state_foreign foreign key ( state ) peferences user_statuses ( id )
Below are the user_statuses and the alteration migration. user_status creation:
Schema::create('user_statuses', function($table){
// Columns
$table->increments('id')->unsigned();
$table->string('name');
// Indexes
// Constraints
});
users alteration:
Schema::table('users',function($table){
// Columns
$table->integer('state')->unsigned();
$table->softDeletes();
// Indexed
// Constraints
$table->foreign('state')->references('id')->on('user_statuses');
});
USERS_STATE_FOREIGN
. Try executing the following:SELECT * FROM ALL_CONSTRAINTS WHERE CONSTRAINT_NAME = 'USERS_STATE_FOREIGN'
. Best of luck. – Bob Jarvis - Reinstate Monica