diff --git a/edb/schema/modules.py b/edb/schema/modules.py index 8b8f6278388..d634ca30137 100644 --- a/edb/schema/modules.py +++ b/edb/schema/modules.py @@ -96,6 +96,19 @@ class AlterModule(ModuleCommand, sd.AlterObject[Module]): astnode = qlast.AlterModule +class RenameModule(ModuleCommand, sd.RenameObject[Module]): + + def apply( + self, + schema: s_schema.Schema, + context: sd.CommandContext, + ) -> s_schema.Schema: + raise errors.SchemaError( + f'renaming modules is not supported', + span=self.span, + ) + + class DeleteModule(ModuleCommand, sd.DeleteObject[Module]): astnode = qlast.DropModule diff --git a/tests/test_edgeql_ddl.py b/tests/test_edgeql_ddl.py index 0a34f5cf9c3..7c1a143ff5a 100644 --- a/tests/test_edgeql_ddl.py +++ b/tests/test_edgeql_ddl.py @@ -8750,6 +8750,19 @@ async def test_edgeql_ddl_modules_04(self): DROP MODULE test_other; """) + async def test_edgeql_ddl_modules_05(self): + await self.con.execute(r""" + CREATE MODULE foo; + """) + + async with self.assertRaisesRegexTx( + edgedb.SchemaError, + "renaming modules is not supported", + ): + await self.con.execute(r""" + ALTER MODULE foo RENAME TO bar; + """) + async def test_edgeql_ddl_extension_package_01(self): await self.con.execute(r""" CREATE EXTENSION PACKAGE foo_01 VERSION '1.0' {