From d2a901d424e6ca8cce54d08771e17b483b7c1022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Wed, 14 Jun 2023 16:42:22 +0200 Subject: [PATCH] Prevent schema alterations on the default schema --- server/system/service/dal_schema_alteration.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/system/service/dal_schema_alteration.go b/server/system/service/dal_schema_alteration.go index a22e318d6..726443d66 100644 --- a/server/system/service/dal_schema_alteration.go +++ b/server/system/service/dal_schema_alteration.go @@ -199,6 +199,12 @@ func (svc dalSchemaAlteration) ModelAlterations(ctx context.Context, m *dal.Mode func (svc dalSchemaAlteration) SetAlterations(ctx context.Context, m *dal.Model, stale []*dal.Alteration, aa ...*dal.Alteration) (err error) { // @todo boilerplate code around this + c := svc.dal.GetConnectionByID(0) + if m.ConnectionID == c.ID && m.Ident == "compose_record" { + err = fmt.Errorf("cannot set alterations for default schema") + return + } + return store.Tx(ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) { // Firstly get rid of the old ones aux := make([]*types.DalSchemaAlteration, len(stale))