-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Prefix table names with schema names #30
Comments
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 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 If anything does not work as expected, please let me know |
Thanks, the entities are now generated correctly with schema prefixes. But 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:
The text was updated successfully, but these errors were encountered: