예제 #1
0
    def canonicalize_alter_from_external_ref(
        self,
        schema: s_schema.Schema,
        context: sd.CommandContext,
    ) -> None:
        if (not self.get_attribute_value('abstract') and
            (indexexpr := self.get_attribute_value('expr')) is not None):
            # To compute the new name, we construct an AST of the
            # index, since that is the infrastructure we have for
            # computing the classname.
            ast = qlast.CreateIndex(
                name=qlast.ObjectRef(name="idx", module="__"),
                expr=indexexpr.qlast,
            )
            quals = sn.quals_from_fullname(self.classname)
            new_name = self._classname_from_ast_and_referrer(
                schema, sn.QualName.from_string(quals[0]), ast, context)
            if new_name == self.classname:
                return

            rename = self.scls.init_delta_command(schema,
                                                  sd.RenameObject,
                                                  new_name=new_name)
            rename.set_attribute_value('name',
                                       value=new_name,
                                       orig_value=self.classname)
            self.add(rename)
예제 #2
0
파일: sdl.py 프로젝트: willingc/edgedb
 def reduce_INDEX_OnExpr(self, *kids):
     self.val = qlast.CreateIndex(
         name=qlast.ObjectRef(name='idx'),
         expr=kids[1].val,
     )
예제 #3
0
 def reduce_CREATE_INDEX_NodeName_OnExpr(self, *kids):
     self.val = qlast.CreateIndex(
         name=kids[2].val,
         expr=kids[3].val
     )
예제 #4
0
파일: sdl.py 프로젝트: fantix/edgedb
 def reduce_INDEX_OnExpr_CreateIndexSDLCommandsBlock(self, *kids):
     self.val = qlast.CreateIndex(
         name=qlast.ObjectRef(name='idx'),
         expr=kids[1].val,
         commands=kids[2].val,
     )
예제 #5
0
파일: sdl.py 프로젝트: rafaelrosabal/edgedb
 def reduce_INDEX_ShortNodeName_OnExpr(self, *kids):
     self.val = qlast.CreateIndex(
         name=kids[1].val,
         expr=kids[2].val,
     )