@@ -288,6 +288,16 @@ pub enum AlterTableOperation {
288
288
equals : bool ,
289
289
algorithm : AlterTableAlgorithm ,
290
290
} ,
291
+
292
+ /// `LOCK [=] { DEFAULT | NONE | SHARED | EXCLUSIVE }`
293
+ ///
294
+ /// [MySQL]-specific table alter lock.
295
+ ///
296
+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
297
+ Lock {
298
+ equals : bool ,
299
+ lock : AlterTableLock ,
300
+ } ,
291
301
/// `AUTO_INCREMENT [=] <value>`
292
302
///
293
303
/// [MySQL]-specific table option for raising current auto increment value.
@@ -366,6 +376,30 @@ impl fmt::Display for AlterTableAlgorithm {
366
376
}
367
377
}
368
378
379
+ /// [MySQL] `ALTER TABLE` lock.
380
+ ///
381
+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
382
+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
383
+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
384
+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
385
+ pub enum AlterTableLock {
386
+ Default ,
387
+ None ,
388
+ Shared ,
389
+ Exclusive ,
390
+ }
391
+
392
+ impl fmt:: Display for AlterTableLock {
393
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
394
+ f. write_str ( match self {
395
+ Self :: Default => "DEFAULT" ,
396
+ Self :: None => "NONE" ,
397
+ Self :: Shared => "SHARED" ,
398
+ Self :: Exclusive => "EXCLUSIVE" ,
399
+ } )
400
+ }
401
+ }
402
+
369
403
#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
370
404
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
371
405
#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -692,6 +726,9 @@ impl fmt::Display for AlterTableOperation {
692
726
value
693
727
)
694
728
}
729
+ AlterTableOperation :: Lock { equals, lock } => {
730
+ write ! ( f, "LOCK {}{}" , if * equals { "= " } else { "" } , lock)
731
+ }
695
732
}
696
733
}
697
734
}
0 commit comments