@@ -968,3 +968,67 @@ func (atc *AlterTableCollation) WithChildren(children ...sql.Node) (sql.Node, er
968968 natc .Table = children [0 ]
969969 return & natc , nil
970970}
971+
972+ type AlterTableComment struct {
973+ ddlNode
974+ Table sql.Node
975+ Comment string
976+ }
977+
978+ var _ sql.Node = (* AlterTableComment )(nil )
979+ var _ sql.Databaser = (* AlterTableComment )(nil )
980+
981+ func NewAlterTableComment (table * ResolvedTable , comment string ) * AlterTableComment {
982+ return & AlterTableComment {
983+ ddlNode : ddlNode {Db : table .SqlDatabase },
984+ Table : table ,
985+ Comment : comment ,
986+ }
987+ }
988+
989+ // WithDatabase implements the interface sql.Databaser
990+ func (atc * AlterTableComment ) WithDatabase (db sql.Database ) (sql.Node , error ) {
991+ natc := * atc
992+ natc .Db = db
993+ return & natc , nil
994+ }
995+
996+ // IsReadOnly implements the interface sql.Node
997+ func (atc * AlterTableComment ) IsReadOnly () bool {
998+ return false
999+ }
1000+
1001+ // String implements the interface sql.Node
1002+ func (atc * AlterTableComment ) String () string {
1003+ return fmt .Sprintf ("alter table %s comment %s" , atc .Table .String (), atc .Comment )
1004+ }
1005+
1006+ // DebugString implements the interface sql.Node
1007+ func (atc * AlterTableComment ) DebugString () string {
1008+ return atc .String ()
1009+ }
1010+
1011+ // Resolved implements the interface sql.Node
1012+ func (atc * AlterTableComment ) Resolved () bool {
1013+ return atc .Table .Resolved () && atc .ddlNode .Resolved ()
1014+ }
1015+
1016+ // Schema implements the interface sql.Node
1017+ func (atc * AlterTableComment ) Schema () sql.Schema {
1018+ return atc .Table .Schema ()
1019+ }
1020+
1021+ // Children implements the interface sql.Node
1022+ func (atc * AlterTableComment ) Children () []sql.Node {
1023+ return []sql.Node {atc .Table }
1024+ }
1025+
1026+ // WithChildren implements the interface sql.Node
1027+ func (atc * AlterTableComment ) WithChildren (children ... sql.Node ) (sql.Node , error ) {
1028+ if len (children ) != 1 {
1029+ return nil , sql .ErrInvalidChildrenNumber .New (atc , len (children ), 1 )
1030+ }
1031+ natc := * atc
1032+ natc .Table = children [0 ]
1033+ return & natc , nil
1034+ }
0 commit comments