@@ -288,6 +288,16 @@ pub enum AlterTableOperation {
288288 equals : bool ,
289289 algorithm : AlterTableAlgorithm ,
290290 } ,
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+ } ,
291301 /// `AUTO_INCREMENT [=] <value>`
292302 ///
293303 /// [MySQL]-specific table option for raising current auto increment value.
@@ -366,6 +376,30 @@ impl fmt::Display for AlterTableAlgorithm {
366376 }
367377}
368378
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+
369403#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
370404#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
371405#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -692,6 +726,9 @@ impl fmt::Display for AlterTableOperation {
692726 value
693727 )
694728 }
729+ AlterTableOperation :: Lock { equals, lock } => {
730+ write ! ( f, "LOCK {}{}" , if * equals { "= " } else { "" } , lock)
731+ }
695732 }
696733 }
697734}
0 commit comments