A description of the structure of the database - including the structure of the tables, columns, constraints, views, etc, etc... that make up the database.Normally defined in the text, generally SQL in an RDBMS, the schema describes the complete blueprint for the database, defining everything about the database except that data itself.
Questions tagged [database-schema]
2931 questions
16
votes
4 answers
Schema for User Ratings - Key/Value DB
We're using MongoDB and I'm figuring out a schema for storing Ratings.
Ratings will have values of 1-5.
I want to store other values such as fromUser
This is fine but the main question I have is setting it up so that recalculating the average is…

OdieO
- 6,836
- 7
- 56
- 88
16
votes
4 answers
Why is ISql100DatabaseEncryptionKey blocking Schema Compare
I am trying to do a Schema Compare in Visual Studio 2010 on some SQL Server 2008 databases. But I get the following error. What does it mean and how can I ignore?
An error was received from SQL Server while attempting to reverse engineer elements of…

jesperlind
- 2,092
- 2
- 20
- 22
16
votes
4 answers
Creating a database with MySQL Workbench from existing schema/model
I built a database schema (or Model?) with MySQL Workbench. I'd like to now make it into an actual database.
I've seen Forward and Reverse engineer options and can't find a clear answer on if either are what I need.
How can I turn this into an…

TheLettuceMaster
- 15,594
- 48
- 153
- 259
15
votes
3 answers
How to get a list of all tables in two different databases
I'm trying to create a little SQL script (in SQL Server Management Studio) to get a list of all tables in two different databases. The goal is to find out which tables exist in both databases and which ones only exist in one of them.
I have found…

M4N
- 94,805
- 45
- 217
- 260
15
votes
3 answers
How does Envers deal with schema changes?
I am thinking about switching from a self-implemented versioning-solution to Hibernate Envers, but I am not quite sure yet. I have read a lot about it, but I am concerned about schema changes and how Envers deals with them after having historized…

Sakuraba
- 2,631
- 1
- 19
- 13
15
votes
3 answers
How do I set the schema in SQLAlchemy for MSSQL?
I currently do this:
#!/usr/bin/env python
# 3rd party modules
from sqlalchemy import create_engine # requires pymssql
# local modules
from config import cfg
connection_string = 'mssql+pymssql://{user}:{password}@{host}:{port}/{db}'
engine =…

Martin Thoma
- 124,992
- 159
- 614
- 958
15
votes
5 answers
When is referential integrity not appropriate?
I understand the need to have referential integrity for limiting specific values on entry or possibly preventing them from removal upon a request of deletion. However, I am unclear as to a valid use case which would exclude this mechanism from…

Curtis Inderwiesche
- 4,940
- 19
- 60
- 82
15
votes
1 answer
Liquibase changeSet with failOnError="false" are always ran?
I'm trying to execute the following changeSet in liquibase which should create an index. If the index doesn't exist, it should silently fail:

ebi
- 325
- 1
- 3
- 8
14
votes
5 answers
What is the best database schema to support values that are only appropriate to specific rows?
I have a db table called Calendar with fields
Id (PK)
Name
Description
CalendarTypeId (FK into CalendarType table)
I have another table called CalendarType with fields
Id (PK)
Name
Description
The issue is that i need to store an additional…

leora
- 188,729
- 360
- 878
- 1,366
14
votes
3 answers
How to share a table between multiple Postgresql databases
My web app has multiple deployments -- each is a unique site with a unique URL.
Each deployment has different data, UI, etc. but a very similar Postgresql database structure (with PostGIS). The databases all live on the same DB server. I would…

lubar
- 2,589
- 2
- 26
- 28
14
votes
1 answer
Can't make two 1:1 relations in one model in Prisma. Ambiguous relation detected
I'm trying to make two 1:1 relations in one model in Prisma ORM, but got following error:
Error validating model "Person": Ambiguous relation detected. The fields placeOfBirth and placeOfDeath in model Person both refer to Place. Please provide…

Nikolay Solovyov
- 143
- 1
- 6
14
votes
4 answers
Why is database view used?
Is using "view" in db design right method or we should handle it code side? What are the advantages or disadvantages?

Sessiz Saat
- 1,079
- 8
- 20
14
votes
1 answer
How does Trello store data in MongoDB? (Collection per board?)
How does Trello store their data (cards) in MongoDB?
I read ( How does Trello show history so quickly? ) that their Actions collection is the largest one. Thus I assume that they do not store all cards in one gigantic collection.
The only other…

Ben
- 2,435
- 6
- 43
- 57
13
votes
1 answer
SQLite create pre-populated FTS table
Is there a way to create an FTS table in SQLite that is pre-populated with data from a SELECT query?
I know it’s possible to create a regular table that is prepopulated with data from a SELECT:
CREATE TABLE foo AS SELECT ref_id, name FROM…

David Cairns
- 603
- 5
- 18
13
votes
2 answers
Private Message Database Design
Alright, so I think I'm pretty close to having what I need, but I'm unsure about a couple of things:
TABLE messages
message_id
message_type
sender_id
timestamp
TABLE message_type
message_type_code (1, 2, 3)
name (global, company, personal)
TABLE…

dcolumbus
- 9,596
- 26
- 100
- 165