I'd like to add new schema (like dbo but with different name, ex. Fruit) to database. I'm using database project in Visual Studio 2013. I have an existing database project with tables, schemas, stored procedures, pre and post deployment scripts, etc. Database project is version controlled. I'd like generating publish scripts to work nicely as it did before I added a new schema.
我想在数据库中添加新的模式(比如dbo,但名称不同,例如Fruit)。我在Visual Studio 2013中使用数据库项目。我有一个现有的数据库项目,包括表,模式,存储过程,部署前后脚本等。数据库项目是版本控制的。我想生成发布脚本以便像我添加新模式之前一样工作。
Creating Fruit.schema.sql in SchemaObjects/Database Level Objects/Security/Schemas with content
在SchemaObjects / Database Level Objects / Security / Schemas中创建包含内容的Fruit.schema.sql
CREATE SCHEMA [Fruit]
will create schema but won't add Fruit schema folder sub tree in Schema Objects/Schemas folder like dbo schema has. Should I create that subtree manually? I suspect there is smarter way to achive this.
将创建模式但不会在模式对象/模式文件夹中添加水果模式文件夹子树,如dbo模式。我应该手动创建该子树吗?我怀疑有更聪明的方法来实现这个目标。
3 个解决方案
#1
9
Yes, create the folder manually. There's no smarter way to do this :-)
是的,手动创建文件夹。没有更聪明的方法来做到这一点:-)
#2
1
I know this is pretty old, but I thought whoever is looking at this and scratching his/her head - how do I create all these folders automatically? can benefit from this link - copy folders
我知道这已经很老了,但我想是谁在看这个并抓挠他/她的头 - 如何自动创建所有这些文件夹?可以从此链接中受益 - 复制文件夹
so to create a new schema named "mh" you could do
robocopy .\dbo .\mh /e /xf .
所以要创建一个名为“mh”的新模式,你可以做robocopy。\ dbo。\ mh / e / xf。
#3
0
In Visual Studio 2017, I can add item => search for schema, and that creates a sql file that includes the line: create schema [fruit]
.
在Visual Studio 2017中,我可以添加item => search for schema,并创建一个包含以下行的sql文件:create schema [fruit]。
Then, I can reference that schema when creating other database objects.
然后,我可以在创建其他数据库对象时引用该架构。
#1
9
Yes, create the folder manually. There's no smarter way to do this :-)
是的,手动创建文件夹。没有更聪明的方法来做到这一点:-)
#2
1
I know this is pretty old, but I thought whoever is looking at this and scratching his/her head - how do I create all these folders automatically? can benefit from this link - copy folders
我知道这已经很老了,但我想是谁在看这个并抓挠他/她的头 - 如何自动创建所有这些文件夹?可以从此链接中受益 - 复制文件夹
so to create a new schema named "mh" you could do
robocopy .\dbo .\mh /e /xf .
所以要创建一个名为“mh”的新模式,你可以做robocopy。\ dbo。\ mh / e / xf。
#3
0
In Visual Studio 2017, I can add item => search for schema, and that creates a sql file that includes the line: create schema [fruit]
.
在Visual Studio 2017中,我可以添加item => search for schema,并创建一个包含以下行的sql文件:create schema [fruit]。
Then, I can reference that schema when creating other database objects.
然后,我可以在创建其他数据库对象时引用该架构。