database-schema

How to set default schema in Yii2

Deadly 提交于 2019-12-01 03:06:22
My Yii2 is setup with PostgreSQL. Instead of using separate database per project, I like to use schema for each project. Problem with later setup is that I can't figure out how to select default schema "defaultSchema" through configuration. I am having a problem with migrations table because it defaults to "public" schema when I run migration command. Default "public" schema also prevents using database user's search_path. Although I set up my db user with "search_path=myschema, public" I still cannot use migrations without additional configuration, because during runtime Yii looks for the

SQL Server Compare Schema in Visual Studio 2017

吃可爱长大的小学妹 提交于 2019-12-01 02:20:37
问题 I am attempting to compare schemas of two databases on the same server. The two databases are named benchmarkdb and benchmarkdb_dev . In Visual Studio 2017, I go to Tools > SQL Server > New Schema Compare... From both drop down menus labeled "Select Source" and "Select Target" (as seen in the picture below), I want to select benchmarkdb as source and bencmarkdb_dev as target. After clicking to select a source, the "Select Source Schema" pops up, and I clicked the "Select Connection..." button

Design database for category, subcategory and associated books

我的未来我决定 提交于 2019-11-30 23:45:01
I know there has been a few answer to a couple of questions similar to the one am asking. But their approach didn't look convincing. My question is how would I structure a database for a category that can have books and a subcategory which can also have books? I have already design a database, but am not convinced by the approach. So I would really appreciate if the guys with experience gave me some advice or improvement or a completely different approach. This how my tables look like (bare in mind this is not the actual code) TABLE Category ID user_id -- Foreign key from user name TABLE

Which normal form does this table violate?

风格不统一 提交于 2019-11-30 22:40:22
Consider this table: +-------+-------+-------+-------+ | name |hobby1 |hobby2 |hobby3 | +-------+-------+-------+-------+ | kris | ball | swim | dance | | james | eat | sing | sleep | | amy | swim | eat | watch | +-------+-------+-------+-------+ There is no priority on the types of hobbies, thus all the hobbies belong to the same domain. That is, the hobbies in the table can be moved on any hobby# column. It doesn't matter on which column, a particular hobby can be in any column. Which database normalization rule does this table violate? Edit Q. Is "the list of hobbies [...] in an arbitrary

MongoDB: remove unique constraint

て烟熏妆下的殇ゞ 提交于 2019-11-30 22:39:43
问题 I'm trying the "Develop a RESTful API Using Node.js With Express and Mongoose" example and I ran into a problem with the MongoDB Schema: POST: { title: 'My Awesome T-shirt 2', description: 'All about the details. Of course it\'s black.', style: '12345' } { [MongoError: E11000 duplicate key error index: ecomm_database.products.$style_1 dup key: { : "12345" }] name: 'MongoError', err: 'E11000 duplicate key error index: ecomm_database.products.$style_1 dup key: { : "12345" }', there is a unique

Create an aspect in Alfresco Content Model

强颜欢笑 提交于 2019-11-30 22:19:09
I am starting currently using Alfresco CMS. I need to create an "aspect" in my content model which must contains a number of properties as: Aspect: property 1 : String property 2 : int property 3 : int property 4 : long Moreover it must contains two more properties which are composed either of number of properties as: Format: FormatProperty1: int FormatProperty2: int FormatProperty3: int Metadata: list1: List<String> list2: List<String> MetadataProperty 3: boolean I have not yet created neither a simple content model nor an aspect in Alfresco. Based on my previous knowledge in Relational

Why is database view used?

馋奶兔 提交于 2019-11-30 19:02:59
Is using "view" in db design right method or we should handle it code side? What are the advantages or disadvantages? I see a couple of reasons to use views : Provide a simpler interface : just query the view, and not a dozen tables, doing joins and all Provide an interface that doesnt change (or less often) : Even if you change the structure of the tables, you might be able to modify your view so it still returns the same thing Which means no change is needed in your application's code : it'll still work, as it's using the view, and not directly accessing the tables Only provide an interface

How to support Multi-Languages approach in DataBase Schema?

橙三吉。 提交于 2019-11-30 18:52:18
I want my database to support multi Languages for all text values in its tables. So what is the best approach to do that?. Edit1:: E.G. I've this "Person" table: ID int FirstName nvarchar(20) LastName nvarchar(20) Notes nvarchar(max) BirthDate date ........... So if i want my program to support new language "let say French". should i add new column every time i add new language ? So my "Person" table will look like this ID int FirstName_en nvarchar(20) FirstName_fr nvarchar(20) LastName_en nvarchar(20) LastName_fr nvarchar(20) Notes_en nvarchar(max) Notes_fr nvarchar(max) BirthDate date ......

Add constraint to existing SQLite table

孤街醉人 提交于 2019-11-30 18:24:27
I'm using SQLite, which doesn't support adding a constraint to an existing table. So I can't do something like this (just as an example): ALTER TABLE [Customer] ADD CONSTRAINT specify_either_phone_or_email CHECK (([Phone] IS NOT NULL) OR ([Email] IS NOT NULL)); Are there any workarounds for this scenario? I know: I can add a constraint for a new table, but it isn't new (and it's generated by my ORM, EF Core) I can do a "table rebuild" (rename table, create new one, copy old data, drop temp table) but that seems really complex Ideas Can I somehow make a copy of the table into a new table, with

Design database for category, subcategory and associated books

我的未来我决定 提交于 2019-11-30 18:17:12
问题 I know there has been a few answer to a couple of questions similar to the one am asking. But their approach didn't look convincing. My question is how would I structure a database for a category that can have books and a subcategory which can also have books? I have already design a database, but am not convinced by the approach. So I would really appreciate if the guys with experience gave me some advice or improvement or a completely different approach. This how my tables look like (bare