Questions tagged [database-schema]

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.

2931 questions
10
votes
3 answers

Laravel schema builder INT(11) on integer() and INT(10) on unsignedInteger()

Why does Laravel create the integer column as INT(11) and unsigned integer column as INT(10)? $table->integer('integer'); // INT(11) $table->unsignedInteger('unsignedInteger'); // INT(10)…
Artur K.
  • 3,263
  • 3
  • 38
  • 54
10
votes
3 answers

Rails console database schema checking

I'm new to rails/ruby and I was wondering how I can double check if my database schema is correctly built in rails console In rails c ActiveRecord::Base.connection.tables gave me the output of ["schema_migrations", "users", "expense_pictures",…
Liondancer
  • 15,721
  • 51
  • 149
  • 255
10
votes
2 answers

Storing Exam Questions in a Database

I've been thinking about how I should design a database to hold exam questions for a little over a year now (on and off, mostly off). First, a short description of what I'm after. I would like to design a database flexible enough to store different…
Mick
  • 665
  • 2
  • 6
  • 18
10
votes
3 answers

Why is there a class with entity name plus an underscore for JPA entity class

I am new to JPA, I have created a class like the following /** * */ package programme; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.Id; import…
kenthewala
  • 544
  • 3
  • 8
  • 17
10
votes
6 answers

Storing User Settings - anything wrong with using "Flags" or "Bits" instead of a bunch of bools?

I'm designing the User Settings for my MVC application, and right now I have ~20 boolean settings that the user can toggle. Since every user will always have every setting, I was thinking about storing each setting as a boolean on the User table. …
SB2055
  • 12,272
  • 32
  • 97
  • 202
10
votes
5 answers

2 relationships between 2 entities in ER diagram

I'm trying to draw an ER diagram describing the following: -"Department" employs "Employees" -Some "Employees" are "Special" and have more attributes -Some of the "Employees" ("Special" and non special) are "Managers" -"Managers" manage…
9
votes
5 answers

Get database schema with one query?

Basically I want to get the table names, and the field names for each table from the current database that is connected, nothing else. Is this possible? I know that SHOW TABLES FROM my_database gets you the table names, and SHOW COLUMNS FROM…
Alex
  • 66,732
  • 177
  • 439
  • 641
9
votes
5 answers

Implementing an efficient system of "unread comments" counters

I am trying to find an optimal solution for the following problem: there is a need to design a database (postgres-based), the system of triggers and counters in it, which will form a system of efficiently querying, updating and storing information…
Igor Katson
  • 5,207
  • 3
  • 19
  • 13
9
votes
1 answer

NHibernate SchemaUpdate adding existing foreign keys again?

I'm using SchemaUpdate to synchronize my hbms with existing database. Database has recently created based on hbms and is completely up-to-date. But SchemaUpdate generates all foreign key constraints again. For example suppose you have Student and…
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126
9
votes
2 answers

MongoDB schema design for multiple user types

I'm about to build a Node.js+Express+Mongoose app and I'd like to pick the community's brains and get some advice on best practices and going about creating an efficient schema design. My application is going to include 2 different user types, i.e…
Deadlift
  • 116
  • 1
  • 4
9
votes
1 answer

How to design great database structure for POS system

I am designing mysql database for my POS system. I will explain it as my best. Please kindly help me to design it more successfully! INVENTORY Id bar-code(Primary key) product-name company-id category-id (This table for store product information.…
Oldmax
  • 111
  • 1
  • 2
  • 9
9
votes
5 answers

database schema for timesheet

Could someone help me with a rough database schema for a timesheet application where the i would be able to Store hours per day for a time period ( 2 weeks ) for different projects. Ex person A can put 3 hours for projectA and 4 hours for projectB…
randomThought
  • 6,203
  • 15
  • 56
  • 72
9
votes
2 answers

Java library for reading database schema

I'm looking for a lightweight, open source, more or less cross-database Java library that would allow me to read off metainformation on columns, tables and integrity constraints given a DataSource.
Marat Salikhov
  • 6,367
  • 4
  • 32
  • 35
9
votes
8 answers

SQL Server 2008 - create database script (schema + data) with command-line

In SSMS when I click on the database "Tasks -> Generate Scripts", I get an output script. How do I do the same with a non-graphical tool?
Igor Golodnitsky
  • 4,456
  • 7
  • 44
  • 67
9
votes
4 answers

What are some strategies for maintaining a common database schema with a team of developers and no DBA?

I'm curious about how others have approached the problem of maintaining and synchronizing database changes across many (10+) developers without a DBA? What I mean, basically, is that if someone wants to make a change to the database, what are some…
Mahmoud Abdelkader
  • 23,011
  • 5
  • 41
  • 54