Skip to content

Commit

Permalink
Add a cfg::BranchConfig alias for cfg::DatabaseConfig (#6984)
Browse files Browse the repository at this point in the history
If I had remembered this *before* the 5.0 branch cut, I'd have made
DatabaseConfig abstract and made BranchConfig a concrete subtype,
which would have been generally more satisfying (actual type is
BranchConfig, `IS` works with either), but this version is much safer
to patch in.

Some fixes were needed to make creating a standard library alias work.
  • Loading branch information
msullivan authored Mar 6, 2024
1 parent 58e3be6 commit 40317e2
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion edb/buildmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


# Increment this whenever the database layout or stdlib changes.
EDGEDB_CATALOG_VERSION = 2024_02_28_00_00
EDGEDB_CATALOG_VERSION = 2024_03_04_00_00
EDGEDB_MAJOR_VERSION = 6


Expand Down
1 change: 1 addition & 0 deletions edb/edgeql/compiler/schemactx.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def derive_view(
mark_derived=True,
transient=True,
attrs=attrs,
stdmode=ctx.env.options.bootstrap_mode,
)

if (
Expand Down
1 change: 1 addition & 0 deletions edb/lib/cfg.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ ALTER TYPE cfg::AbstractConfig {
CREATE TYPE cfg::Config EXTENDING cfg::AbstractConfig;
CREATE TYPE cfg::InstanceConfig EXTENDING cfg::AbstractConfig;
CREATE TYPE cfg::DatabaseConfig EXTENDING cfg::AbstractConfig;
CREATE ALIAS cfg::BranchConfig := cfg::DatabaseConfig;


CREATE FUNCTION
Expand Down
1 change: 1 addition & 0 deletions edb/schema/expraliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ def compile_alias_expr(
modaliases=context.modaliases,
schema_view_mode=True,
in_ddl_context_name='alias definition',
bootstrap_mode=context.stdmode,
),
)

Expand Down
2 changes: 2 additions & 0 deletions edb/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def derive_subtype(
inheritance_merge: bool = True,
transient: bool = False,
inheritance_refdicts: Optional[AbstractSet[str]] = None,
stdmode: bool = False,
**kwargs: Any,
) -> typing.Tuple[s_schema.Schema, TypeT]:

Expand Down Expand Up @@ -202,6 +203,7 @@ def derive_subtype(
context = sd.CommandContext(
modaliases={},
schema=schema,
stdmode=stdmode,
)

delta = sd.DeltaRoot()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ async def test_server_proto_configure_05(self):

await self.assert_query_result(
'''
SELECT cfg::DatabaseConfig.__internal_sess_testvalue
SELECT cfg::BranchConfig.__internal_sess_testvalue
''',
[
3
Expand Down

0 comments on commit 40317e2

Please sign in to comment.