Example #1
0
    async def extra(self, context):
        comments = []

        exprs = await self.new_constraint.constraint_code(context)
        constr_name = self.new_constraint.raw_constraint_name()

        if isinstance(exprs, list) and len(exprs) > 1:
            for i, expr in enumerate(exprs):
                constraint = MultiConstraintItem(self.new_constraint, i)

                comment = dbops.Comment(constraint, constr_name)
                comments.append(comment)
        else:
            comment = dbops.Comment(self.new_constraint, constr_name)
            comments.append(comment)

        return comments
Example #2
0
    def generate_extra(self, block: dbops.PLBlock) -> None:
        comments = []

        exprs = self.new_constraint.constraint_code(block)
        constr_name = self.new_constraint.raw_constraint_name()

        if isinstance(exprs, list) and len(exprs) > 1:
            for i, expr in enumerate(exprs):
                constraint = MultiConstraintItem(self.new_constraint, i)

                comment = dbops.Comment(constraint, constr_name)
                comments.append(comment)
        else:
            comment = dbops.Comment(self.new_constraint, constr_name)
            comments.append(comment)

        for comment in comments:
            comment.generate(block)
Example #3
0
 def rename_extra(self, context, new_constraint):
     new_name = new_constraint.raw_constraint_name()
     cmd = dbops.Comment(object=new_constraint, text=new_name)
     return [cmd]
Example #4
0
 async def extra(self, context):
     text = self.raw_constraint_name()
     cmd = dbops.Comment(object=self, text=text)
     return [cmd]
Example #5
0
 def generate_extra(self, block):
     text = self.raw_constraint_name()
     cmd = dbops.Comment(object=self, text=text)
     cmd.generate(block)