@@ -107,29 +107,32 @@ fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> Vec<TableConst
107107 for column in columns {
108108 for ast:: ColumnOptionDef { name, option } in & column. options {
109109 match option {
110- ast:: ColumnOption :: Unique ( constraint) => {
111- constraints. push ( TableConstraint :: Unique ( UniqueConstraint {
112- name : name. clone ( ) ,
113- index_name : None ,
114- index_type_display : ast:: KeyOrIndexDisplay :: None ,
115- index_type : None ,
116- columns : vec ! [ IndexColumn {
117- column: OrderByExpr {
118- expr: SQLExpr :: Identifier ( column. name. clone( ) ) ,
119- options: OrderByOptions {
120- asc: None ,
121- nulls_first: None ,
122- } ,
123- with_fill: None ,
110+ ast:: ColumnOption :: Unique ( UniqueConstraint {
111+ characteristics, ..
112+ } ) => constraints. push ( TableConstraint :: Unique ( UniqueConstraint {
113+ name : name. clone ( ) ,
114+ index_name : None ,
115+ index_type_display : ast:: KeyOrIndexDisplay :: None ,
116+ index_type : None ,
117+ columns : vec ! [ IndexColumn {
118+ column: OrderByExpr {
119+ expr: SQLExpr :: Identifier ( column. name. clone( ) ) ,
120+ options: OrderByOptions {
121+ asc: None ,
122+ nulls_first: None ,
124123 } ,
125- operator_class: None ,
126- } ] ,
127- index_options : vec ! [ ] ,
128- characteristics : constraint. characteristics ,
129- nulls_distinct : NullsDistinctOption :: None ,
130- } ) )
131- }
132- ast:: ColumnOption :: PrimaryKey ( constraint) => {
124+ with_fill: None ,
125+ } ,
126+ operator_class: None ,
127+ } ] ,
128+ index_options : vec ! [ ] ,
129+ characteristics : * characteristics,
130+ nulls_distinct : NullsDistinctOption :: None ,
131+ } ) ) ,
132+ ast:: ColumnOption :: PrimaryKey ( PrimaryKeyConstraint {
133+ characteristics,
134+ ..
135+ } ) => {
133136 constraints. push ( TableConstraint :: PrimaryKey ( PrimaryKeyConstraint {
134137 name : name. clone ( ) ,
135138 index_name : None ,
@@ -146,26 +149,33 @@ fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> Vec<TableConst
146149 operator_class: None ,
147150 } ] ,
148151 index_options : vec ! [ ] ,
149- characteristics : constraint . characteristics ,
152+ characteristics : * characteristics,
150153 } ) )
151154 }
152- ast:: ColumnOption :: ForeignKey ( constraint) => {
155+ ast:: ColumnOption :: ForeignKey ( ForeignKeyConstraint {
156+ foreign_table,
157+ referred_columns,
158+ on_delete,
159+ on_update,
160+ characteristics,
161+ ..
162+ } ) => {
153163 constraints. push ( TableConstraint :: ForeignKey ( ForeignKeyConstraint {
154164 name : name. clone ( ) ,
155165 index_name : None ,
156166 columns : vec ! [ ] ,
157- foreign_table : constraint . foreign_table . clone ( ) ,
158- referred_columns : constraint . referred_columns . clone ( ) ,
159- on_delete : constraint . on_delete ,
160- on_update : constraint . on_update ,
167+ foreign_table : foreign_table. clone ( ) ,
168+ referred_columns : referred_columns. clone ( ) ,
169+ on_delete : on_delete. clone ( ) ,
170+ on_update : on_update. clone ( ) ,
161171 match_kind : None ,
162- characteristics : constraint . characteristics ,
172+ characteristics : * characteristics,
163173 } ) )
164174 }
165- ast:: ColumnOption :: Check ( constraint ) => {
175+ ast:: ColumnOption :: Check ( CheckConstraint { name , expr , .. } ) => {
166176 constraints. push ( TableConstraint :: Check ( CheckConstraint {
167177 name : name. clone ( ) ,
168- expr : constraint . expr . clone ( ) ,
178+ expr : expr. clone ( ) ,
169179 enforced : None ,
170180 } ) )
171181 }
0 commit comments