Closed Hirvox closed 1 year ago
Thanks for bringing that up and creating the detailed feature request - I really appreciate it!
That makes total sense - I will be releasing that feature shortly
This feature is available in Version 0.6.0
The schema prefix is disabled by default, but can be enabled by the config showSchemaPrefix
. For the separator .
is used by default, but can be overwritten by schemaPrefixSeparator
.
All the configs can either be set via the command line, run config or the global mermerd config (see readme for details)
Your described example can e.g. be achieved by mermerd --showSchemaPrefix --schemaPrefixSeparator="_"
If anything does not work as expected, please let me know
Thanks, the entities are now generated correctly with schema prefixes. But showSchemaPrefix
doesn't seem to apply to entity relationships.
A slightly more complicated example:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE SCHEMA Foo
GO
CREATE TABLE [Foo].[Bar](
[Baz] [nchar](10) NULL,
[Qux] [nchar](10) NULL,
[Id] [uniqueidentifier] NOT NULL,
CONSTRAINT [PK_Bar] PRIMARY KEY CLUSTERED
(
[Id] ASC
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [Foo].[Fred](
[BarId] [uniqueidentifier] NOT NULL,
[Waldo] [nchar](10) NULL
) ON [PRIMARY]
GO
ALTER TABLE [Foo].[Fred] WITH CHECK ADD CONSTRAINT [FK_Fred_Bar] FOREIGN KEY([BarId])
REFERENCES [Foo].[Bar] ([Id])
GO
ALTER TABLE [Foo].[Fred] CHECK CONSTRAINT [FK_Fred_Bar]
GO
will generate this graph:
erDiagram
"Foo.Bar" {
nchar Baz
nchar Qux
uniqueidentifier Id PK
}
"Foo.Fred" {
uniqueidentifier BarId FK
nchar Waldo
}
Fred }o--|| Bar : "BarId"
But it should have generated:
erDiagram
"Foo.Bar" {
nchar Baz
nchar Qux
uniqueidentifier Id PK
}
"Foo.Fred" {
uniqueidentifier BarId FK
nchar Waldo
}
"Foo.Fred" }o--|| "Foo.Bar" : "BarId"
Thanks for the quick feedback - this was poorly tested on my side.
The Version 0.6.1 fixes that issue.
0.6.1 works fine, thanks.
I have an SQL Server database with multiple schemas. Some of the table names in these schemas overlap, which causes mermerd to generate two entities with identical names. When rendered, mermaid will combine these entities into a single entity.
Ideally, these table names would be prefixed with the schema name in the generated Mermaid graph, optionally with a configurable separator like an underscore.
For example, for a database with these schemas and tables:
mermerd will generate this graph:
This would be more accurate: