Skip to content

Commit

Permalink
Tweak how bootstrap_mode is threaded into delta contests (#7610)
Browse files Browse the repository at this point in the history
Currently it is semi-ignored in a weird way.
  • Loading branch information
msullivan authored Jul 31, 2024
1 parent 396ffc8 commit 704448e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions edb/server/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ def compile_bootstrap_script(
schema: s_schema.Schema,
eql: str,
*,
bootstrap_mode: bool = True,
expected_cardinality_one: bool = False,
output_format: edbcompiler.OutputFormat = edbcompiler.OutputFormat.JSON,
) -> Tuple[s_schema.Schema, str]:
Expand All @@ -606,7 +607,8 @@ def compile_bootstrap_script(
expected_cardinality_one=expected_cardinality_one,
json_parameters=True,
output_format=output_format,
bootstrap_mode=True,
bootstrap_mode=bootstrap_mode,
log_ddl_as_migrations=False,
)

return edbcompiler.compile_edgeql_script(ctx, eql)
Expand Down Expand Up @@ -1790,7 +1792,9 @@ async def _init_defaults(schema, compiler, conn):
CREATE MODULE default;
'''

schema, sql = compile_bootstrap_script(compiler, schema, script)
schema, sql = compile_bootstrap_script(
compiler, schema, script, bootstrap_mode=False
)
await _execute(conn, sql)
return schema

Expand Down
2 changes: 2 additions & 0 deletions edb/server/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def new_compiler_context(
internal_schema_mode: bool = False,
protocol_version: defines.ProtocolVersion = defines.CURRENT_PROTOCOL,
backend_runtime_params: Optional[pg_params.BackendRuntimeParams] = None,
log_ddl_as_migrations: bool = True,
) -> CompileContext:
"""Create and return an ad-hoc compiler context."""

Expand All @@ -313,6 +314,7 @@ def new_compiler_context(
backend_runtime_params=(
backend_runtime_params or pg_params.get_default_runtime_params()
),
log_ddl_as_migrations=log_ddl_as_migrations,
)

return ctx
Expand Down
2 changes: 1 addition & 1 deletion edb/server/compiler/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def _new_delta_context(
) -> s_delta.CommandContext:
return s_delta.CommandContext(
backend_runtime_params=ctx.compiler_state.backend_runtime_params,
stdmode=ctx.bootstrap_mode,
internal_schema_mode=ctx.internal_schema_mode,
**(_get_delta_context_args(ctx) if args is None else args),
)
Expand All @@ -291,6 +290,7 @@ def _new_delta_context(
def _get_delta_context_args(ctx: compiler.CompileContext) -> dict[str, Any]:
"""Get the args needed for delta_and_schema_from_ddl"""
return dict(
stdmode=ctx.bootstrap_mode,
testmode=compiler._get_config_val(ctx, '__internal_testmode'),
allow_dml_in_functions=(
compiler._get_config_val(ctx, 'allow_dml_in_functions')
Expand Down

0 comments on commit 704448e

Please sign in to comment.