def _apply_field_ast( self, schema: s_schema.Schema, context: sd.CommandContext, node: qlast.DDLOperation, op: sd.AlterObjectProperty, ) -> None: assert isinstance(node, qlast.CreateExtensionPackage) if op.property == 'script': node.body = qlast.NestedQLBlock( text=op.new_value, commands=qlparser.parse_block(op.new_value), ) elif op.property == 'version': node.version = qlast.StringConstant(value=str(op.new_value), ) else: super()._apply_field_ast(schema, context, node, op)
def _apply_field_ast( self, schema: s_schema.Schema, context: sd.CommandContext, node: qlast.DDLOperation, op: sd.AlterObjectProperty, ) -> None: assert isinstance(node, qlast.CreateMigration) if op.property == 'script': node.script = op.new_value node.body = qlast.MigrationBody(commands=tuple( qlparser.parse_block(op.new_value)), ) elif op.property == 'parents': if op.new_value and (items := op.new_value.items): assert len(items) == 1 parent = next(iter(items)) node.parent = s_utils.name_to_ast_ref(parent.get_name(schema))