@@ -200,17 +200,18 @@ pub enum AlterTableOperation {
200200 } ,
201201 /// `DROP PRIMARY KEY`
202202 ///
203- /// Note: this is a [MySQL]-specific operation.
204- ///
205- /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
206- DropPrimaryKey ,
203+ /// [MySQL](https://dev.mysql.com/doc/refman/8.4/en/alter-table.html)
204+ /// [Snowflake](https://docs.snowflake.com/en/sql-reference/constraints-drop)
205+ DropPrimaryKey {
206+ drop_behavior : Option < DropBehavior > ,
207+ } ,
207208 /// `DROP FOREIGN KEY <fk_symbol>`
208209 ///
209- /// Note: this is a [MySQL]-specific operation.
210- ///
211- /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
210+ /// [MySQL](https://dev.mysql.com/doc/refman/8.4/en/alter-table.html)
211+ /// [Snowflake](https://docs.snowflake.com/en/sql-reference/constraints-drop)
212212 DropForeignKey {
213213 name : Ident ,
214+ drop_behavior : Option < DropBehavior > ,
214215 } ,
215216 /// `DROP INDEX <index_name>`
216217 ///
@@ -658,8 +659,31 @@ impl fmt::Display for AlterTableOperation {
658659 }
659660 )
660661 }
661- AlterTableOperation :: DropPrimaryKey => write ! ( f, "DROP PRIMARY KEY" ) ,
662- AlterTableOperation :: DropForeignKey { name } => write ! ( f, "DROP FOREIGN KEY {name}" ) ,
662+ AlterTableOperation :: DropPrimaryKey { drop_behavior } => {
663+ write ! (
664+ f,
665+ "DROP PRIMARY KEY{}" ,
666+ match drop_behavior {
667+ None => "" ,
668+ Some ( DropBehavior :: Restrict ) => " RESTRICT" ,
669+ Some ( DropBehavior :: Cascade ) => " CASCADE" ,
670+ }
671+ )
672+ }
673+ AlterTableOperation :: DropForeignKey {
674+ name,
675+ drop_behavior,
676+ } => {
677+ write ! (
678+ f,
679+ "DROP FOREIGN KEY {name}{}" ,
680+ match drop_behavior {
681+ None => "" ,
682+ Some ( DropBehavior :: Restrict ) => " RESTRICT" ,
683+ Some ( DropBehavior :: Cascade ) => " CASCADE" ,
684+ }
685+ )
686+ }
663687 AlterTableOperation :: DropIndex { name } => write ! ( f, "DROP INDEX {name}" ) ,
664688 AlterTableOperation :: DropColumn {
665689 has_column_keyword,
0 commit comments