database-design

Manage user warnings

Hi, I'm not used to work with values that should decrement every a timelapse like for a user warned, for example a warn which persist for 30 days that can reach a maximum value of 3 warns before the user get banned I thought to design a user table like this but now I should work on it, I find it not useful on decrementing the values eve...

pending data approval

I have a website that allows users with accounts. Account profiles are displayed on the front end of a website. Users can login and update their data, but it all must be approved by an admin (on a form) before the front end content reflects their update. The "live" data is stored across multiple tables in a Postgresql DB. I'm looking...

Database Design - Application Integration with Other Systems

I'm currently integrating external applications in my app ex SalesForce.com. My question pertains to properly designing tables for data capturing custom fields. So for SalesForce all companies have an Organization ID but then they can also have custom fields for capturing data. I've looked at two options for handling this. Let them cr...

How do I handle an inventory tracking data model in rails with mysql?

Okay, so I am modeling a Datacenter with an inventory of Parts for replacement of failures inside a Server. (present models italicized). I have an InventoryEntries model because I have a swap model that a datacenter enters on a form to record that a replacement part(cpu,psu,fan,bbwc) has been taken from inventory and placed in a server b...

Help on my django models for my shoe review website.

What i'm trying to achieve at this point: Allow me to add new shoe objects, and shoe review objects. complete Allow "Owner Reviews" on each shoe complete (I think, but there might be somewhere in my model I can improve) Allow ratings of attributes defined by me which are linked to a particular shoe. Preferably, having an easy way to it...

Is a generic model an antipattern?

Now I have something that I have not seen it before: the database is really generic. For example: instead of a concrete type we have a generic one: device, and it relates to a custom properties table. Unfortunatelly, the model over its entities represents those tables, so the model does not talk about the business at all. At the end p...

Data localization in SQL Server with GUIDs or...?

I need to make a database that is highly localized. For almost all entities I need a translation to 5+ languages. Some entities even require and additional resource localized (like images which I enter as paths). The question now is: 1: LOOKUP TABLE PER ENTITY/TABLE (kinda bloated schema?) should I create a "Localized" localization lo...

Avoiding Duplicate Data in DB (for use with Rails)

I have five tables that I am trying to get to work nicely together but may need some help. I have three main tables: accounts members and roles. With two join tables account_members and account_member_roles. The accounts and members table are joined by account_members (fk account_id and member_id) table. The other 2 table...

How do I store (and sort) vague date ranges?

Hi, I have a database which needs to store year ranges (such as lifespan) which in some instances aren't very specific. For example, as well as the usual '1960', we have 'c. 1960' for "around 1960", and 1960s for in the decade 1960, as well as 'nd' for no date which is distinctly different from NULL which would be until present. What wo...

Issue with table layout (database design)

My design for my database is almost perfect but for one problem: http://i306.photobucket.com/albums/nn269/MCTWEED15/newDatabase.jpg As you can see - a copy of a book needs a location. However the requirement says if it is a short loan then the book will not be found on the shelves/rows. This means, with the current structure ...

Django multi tennant architecture - Should all models have a reference to the tennant_id

Let's say that accounts in my SAAS are of the type Account(models.Model). Would the following be a good idea? class MyModel(models.Model): account = models.ForeignKey(Account) spam = models.CharField(max_length=255) class MyOtherModel(models.Model): # The next attribute `account` is the line in question. # Should it be ...

Suggestions needed for threading and process architecture for search engine software.

The software is a classic search engine. There is one portion of the app that is tasked with crawling/collecting data, and there is another that takes that data and builds an index or database. The final portion handles queries from clients, and performs a search on the data, before retrieving the results. The specific engine that I'm d...

How do news sites prevent duplicate articles from showing up on homepage?

News sites usually have a featured section and some category based news. The featured articles belong to a category but when they're featured they don't show up in the category section - what's the common way of doing this? Should I save a list of all the articles that are featured, then grab the latest news from each category, except pr...

How to model Users with Roles and how to fetch them from the Database

I guess this is a common Problem: consider an application where Users have a Role You will likely have something like User username : String role : String but in your database you have CREATE TABLE IF NOT EXISTS roles ( role_id TINYINT(1) UNSIGNED AUTO_INCREMENT, role_name VARCHAR(10) NOT NULL, PRIMARY KEY...

How to Mass Assign Then Edit Individually

Background: I have an application with athletes, each of these athletes (Athlete model) can be assigned workouts (Workout model, workout_assignment through model). Problem: At first I thought that using a through connection with athletes having many workouts through workout_assignment and workouts having many athletes through workout_as...

True or False: Good design calls for every table to have a primary key, if nothing else, a running integer

Consider a grocery store scenario (I'm making this up) where you have FACT records that represent a sale transaction, where the columns of the Fact table include SaleItemFact Table ------------------ CustomerID ProductID Price DistributorID DateOfSale Etc Etc Etc Even if there are duplicates in the table when you consi...

SQL Server primary key on datetime field

I'm creating a new table in SQL Server 2005 that needs 2 fields: DateTime and MyValue (Int32). The DateTime field will be unique so I will be setting a unique constraint on it. Which table structure is better and why? MyIndex (PK, int) MyDate (datetime) (IX_UniqueKey) MyValue (int) or MyDate (PK, datetime) MyValue (int) My feeling i...

Database doubly connected relationship inserting problem

I have two tables Plants and Information. For every plant there are many information, but for each plant there is a single MainInformation. So there is a one-to-many relationship and a one-to-one relationship between the two. The Information table has a PlantID and the Plants table has a MainInformationID. I want both fields in both tabl...

Maker/ Checker Design Module

i want to design maker/ checker module in my project like if user A add new user so the another User B will approve or reject this adding. i want to know the best practices of design for this module in the database ....... any help ...

Star-schema: Separate dimensions for clients and non-clients or shared dimension for attendants?

I'm new to modeling star schemas, fresh from reading the Data Warehouse Toolkit. I have a business process that has clients and non-clients calling into conference calls with some of our employees. My fact table, call it "Audience", will contain a measure of how long an attending person was connected to the call, and the cost of this ...