File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -117,18 +117,17 @@ pub fn try_purify_table_source_create_sql_ast(
117
117
} ) ;
118
118
}
119
119
120
- // Remove primary key constraint from the column options. It will be specified with
121
- // table constraints later.
122
- column_def
123
- . options
124
- . retain ( |o| !matches ! ( o. option, ColumnOption :: Unique { is_primary: true } ) ) ;
125
-
126
120
purified_column_defs. push ( column_def) ;
127
121
}
128
122
* column_defs = purified_column_defs;
129
123
130
- if row_id_index. is_none ( ) {
131
- // User-defined primary key.
124
+ // Specify user-defined primary key in table constraints.
125
+ let has_pk_column_constraint = column_defs. iter ( ) . any ( |c| {
126
+ c. options
127
+ . iter ( )
128
+ . any ( |o| matches ! ( o. option, ColumnOption :: Unique { is_primary: true } ) )
129
+ } ) ;
130
+ if !has_pk_column_constraint && row_id_index. is_none ( ) {
132
131
let mut pk_columns = Vec :: new ( ) ;
133
132
134
133
for & id in pk_column_ids {
You can’t perform that action at this time.
0 commit comments