@@ -151,8 +151,18 @@ pub enum AlterTableOperation {
151151 } ,
152152 /// `DROP PRIMARY KEY`
153153 ///
154- /// Note: this is a MySQL-specific operation.
154+ /// Note: this is a [MySQL]-specific operation.
155+ ///
156+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
155157 DropPrimaryKey ,
158+ /// `DROP FOREIGN KEY <fk_symbol>`
159+ ///
160+ /// Note: this is a [MySQL]-specific operation.
161+ ///
162+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
163+ DropForeignKey {
164+ name : Ident ,
165+ } ,
156166 /// `ENABLE ALWAYS RULE rewrite_rule_name`
157167 ///
158168 /// Note: this is a PostgreSQL-specific operation.
@@ -278,6 +288,16 @@ pub enum AlterTableOperation {
278288 equals : bool ,
279289 algorithm : AlterTableAlgorithm ,
280290 } ,
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+ } ,
281301 /// `AUTO_INCREMENT [=] <value>`
282302 ///
283303 /// [MySQL]-specific table option for raising current auto increment value.
@@ -356,6 +376,30 @@ impl fmt::Display for AlterTableAlgorithm {
356376 }
357377}
358378
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+
359403#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
360404#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
361405#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -530,6 +574,7 @@ impl fmt::Display for AlterTableOperation {
530574 )
531575 }
532576 AlterTableOperation :: DropPrimaryKey => write ! ( f, "DROP PRIMARY KEY" ) ,
577+ AlterTableOperation :: DropForeignKey { name } => write ! ( f, "DROP FOREIGN KEY {name}" ) ,
533578 AlterTableOperation :: DropColumn {
534579 column_name,
535580 if_exists,
@@ -681,6 +726,9 @@ impl fmt::Display for AlterTableOperation {
681726 value
682727 )
683728 }
729+ AlterTableOperation :: Lock { equals, lock } => {
730+ write ! ( f, "LOCK {}{}" , if * equals { "= " } else { "" } , lock)
731+ }
684732 }
685733 }
686734}
@@ -820,7 +868,7 @@ impl fmt::Display for AlterColumnOperation {
820868 AlterColumnOperation :: SetDefault { value } => {
821869 write ! ( f, "SET DEFAULT {value}" )
822870 }
823- AlterColumnOperation :: DropDefault { } => {
871+ AlterColumnOperation :: DropDefault => {
824872 write ! ( f, "DROP DEFAULT" )
825873 }
826874 AlterColumnOperation :: SetDataType { data_type, using } => {
@@ -1228,9 +1276,9 @@ impl fmt::Display for IndexOption {
12281276 }
12291277}
12301278
1231- /// [Postgres ] unique index nulls handling option: `[ NULLS [ NOT ] DISTINCT ]`
1279+ /// [PostgreSQL ] unique index nulls handling option: `[ NULLS [ NOT ] DISTINCT ]`
12321280///
1233- /// [Postgres ]: https://www.postgresql.org/docs/17/sql-altertable.html
1281+ /// [PostgreSQL ]: https://www.postgresql.org/docs/17/sql-altertable.html
12341282#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
12351283#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
12361284#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -2127,15 +2175,15 @@ pub struct CreateFunction {
21272175 ///
21282176 /// IMMUTABLE | STABLE | VOLATILE
21292177 ///
2130- /// [Postgres ](https://www.postgresql.org/docs/current/sql-createfunction.html)
2178+ /// [PostgreSQL ](https://www.postgresql.org/docs/current/sql-createfunction.html)
21312179 pub behavior : Option < FunctionBehavior > ,
21322180 /// CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
21332181 ///
2134- /// [Postgres ](https://www.postgresql.org/docs/current/sql-createfunction.html)
2182+ /// [PostgreSQL ](https://www.postgresql.org/docs/current/sql-createfunction.html)
21352183 pub called_on_null : Option < FunctionCalledOnNull > ,
21362184 /// PARALLEL { UNSAFE | RESTRICTED | SAFE }
21372185 ///
2138- /// [Postgres ](https://www.postgresql.org/docs/current/sql-createfunction.html)
2186+ /// [PostgreSQL ](https://www.postgresql.org/docs/current/sql-createfunction.html)
21392187 pub parallel : Option < FunctionParallel > ,
21402188 /// USING ... (Hive only)
21412189 pub using : Option < CreateFunctionUsing > ,
0 commit comments