Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

MS SQL - No support for schemas #108

Open
RealizeSoft opened this issue Dec 14, 2020 · 3 comments
Open

MS SQL - No support for schemas #108

RealizeSoft opened this issue Dec 14, 2020 · 3 comments

Comments

@RealizeSoft
Copy link

There is no support for SQL schemas.
I can name a table like "myschema.MyTable" but then on the SQL DDL it does create PK, FK and other constraints with invalid names.

@dineug
Copy link
Owner

dineug commented Jan 26, 2021

If you give me the wrong example data you mentioned, it will be very helpful to solve the problem.

@RealizeSoft
Copy link
Author

Hi - sorry for late reply!

In MS SQL the default schema is dbo and it's possible to add additional schemas in order to organize the tables that belong to each other.

So I'm adding 2 new schemas:
CREATE SCHEMA [tool1]
GO
CREATE SCHEMA [tool2]
GO

Now I'm going to define 3 tables in Vuerd. Each called MyTable and added to one of the schemas (The vuerd.json is pasted below).

When I now want to use the generated SQL DDL then this causes an error on SQL due to the dot in the PK name.

Here is my example:

{ "canvas": { "width": 2000, "height": 2000, "scrollTop": 1, "scrollLeft": 0, "show": { "tableComment": true, "columnComment": true, "columnDataType": true, "columnDefault": true, "columnAutoIncrement": false, "columnPrimaryKey": true, "columnUnique": false, "columnNotNull": true, "relationship": true }, "database": "MSSQL", "databaseName": "", "canvasType": "SQL", "language": "GraphQL", "tableCase": "pascalCase", "columnCase": "camelCase", "setting": { "relationshipDataTypeSync": true, "columnOrder": [ "columnName", "columnDataType", "columnNotNull", "columnUnique", "columnAutoIncrement", "columnDefault", "columnComment" ] } }, "table": { "tables": [ { "name": "MyTable", "comment": "", "columns": [ { "name": "Id", "comment": "", "dataType": "uniqueidentifier", "default": "", "option": { "autoIncrement": false, "primaryKey": true, "unique": false, "notNull": true }, "ui": { "active": false, "pk": true, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 90, "widthDefault": 60 }, "id": "4622d5ef-d8ea-210e-5f27-3dbe5eea38a3" }, { "name": "Name", "comment": "", "dataType": "nvarchar(50)", "default": "", "option": { "autoIncrement": false, "primaryKey": false, "unique": false, "notNull": false }, "ui": { "active": false, "pk": false, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 76, "widthDefault": 60 }, "id": "26d6c272-25b1-f4fd-1d06-51be0d10fd60" } ], "ui": { "active": false, "left": 192, "top": 122, "zIndex": 61, "widthName": 60, "widthComment": 60 }, "id": "9bbd9635-8fa7-501c-b19f-1042bdac5543" }, { "name": "[tool1].[MyTable]", "comment": "", "columns": [ { "name": "Id", "comment": "", "dataType": "uniqueidentifier", "default": "", "option": { "autoIncrement": false, "primaryKey": true, "unique": false, "notNull": true }, "ui": { "active": false, "pk": true, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 90, "widthDefault": 60 }, "id": "7b3fea71-5623-7f91-5d98-c31ba86d2560" }, { "name": "Name", "comment": "", "dataType": "nvarchar(50)", "default": "", "option": { "autoIncrement": false, "primaryKey": false, "unique": false, "notNull": false }, "ui": { "active": false, "pk": false, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 76, "widthDefault": 60 }, "id": "fb3b58ed-afd3-4eb6-50e6-af4b03719738" } ], "ui": { "active": false, "left": 202, "top": 313, "zIndex": 64, "widthName": 97, "widthComment": 60 }, "id": "beb3d5ae-9a8c-4dc9-bfc1-3bd4b687eb3f" }, { "name": "[tool2].[MyTable]", "comment": "", "columns": [ { "name": "Id", "comment": "", "dataType": "uniqueidentifier", "default": "", "option": { "autoIncrement": false, "primaryKey": true, "unique": false, "notNull": true }, "ui": { "active": false, "pk": true, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 90, "widthDefault": 60 }, "id": "4281420f-f111-8264-765a-bd5b82419dd6" }, { "name": "Name", "comment": "", "dataType": "nvarchar(50)", "default": "", "option": { "autoIncrement": false, "primaryKey": false, "unique": false, "notNull": false }, "ui": { "active": false, "pk": false, "fk": false, "pfk": false, "widthName": 60, "widthComment": 60, "widthDataType": 76, "widthDefault": 60 }, "id": "acae502d-9033-6226-075e-3489b00ea4f7" } ], "ui": { "active": false, "left": 201, "top": 504, "zIndex": 67, "widthName": 97, "widthComment": 60 }, "id": "b7b9c8d3-c874-85bc-b502-5deade2101fb" } ], "indexes": [] }, "memo": { "memos": [] }, "relationship": { "relationships": [] } }

Thanks !

@dineug
Copy link
Owner

dineug commented May 8, 2021

I've been thinking about it.
One schema in one file.

I don't think it'll be possible to modify it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants