Constrains and FK's being removed

已回答

Hello, so basically I've created a table using DG but it's actually removing my FK's and constrains after I create the table:
 This is my query

create table test ( id int auto_increment primary key, user_id int null, constraint test_users_id_fk foreign key (user_id) references users (id) on delete cascade ); 

 

This is converted into:

create table test ( id int auto_increment primary key, user_id int null ); create index test_users_id_fk on test (user_id);

This wasn't happening before, and it was working just fine

0

Hi,

How did you determine that constraints and FK have been removed and the first query was converted into the second one - visually in the Database Explorer, in the Modify Table dialog, by running some queries or another way?

Please share the following:

  1. DDL for both the test and users tables. You can get these by double-clicking on each table name in the Database Explorer and selecting Navigation > Go to DDL.
  2. Results of the following query:

    SELECT * FROM information_schema.key_column_usage 
    WHERE table_name = 'test' AND constraint_name = 'test_users_id_fk';
  3. idea.log file (Help > Show Log in Explorer or Help > Show Log in Finder). You can upload the log file to JetBrains Upload and share the upload ID so I can locate the file.
0

请先登录再写评论。