database-schema

Handling data maintenance in Object Databases like db4o

One thing I have continually found very confusing about using an object database like db4o is how you are supposed to handle complex migrations that would normally be handled by SQL/PL-SQL. For example imagine you had a table in a relational database called my_users. Originally you had a column named "full_name", now that your softwa...

Help a CRUD programmer think about an "approval workflow"

I've been working on a web application that is basically a CRUD application (Create, Read, Update, Delete). Recently, I've started working on what I'm calling an "approval workflow". Basically, a request is generated for a material and then sent for approval to a manager. Depending on what is requested, different people need to approve t...

postgresql duplicate table names best practice

My company has a handful of apps that we deploy in the websites we build. Recently a very old app needed to be included along side a newer app and there was a conflict w/ a duplicate table name needed to be used by both apps. We are now in the process of updating an old app and there will be some DB updates. I'm curious what people ...

Need help to create database schema for wholesale online tee store

Hi, I'm currently working on wholesale online t-shirt shop. I have done this for fixed quantity and price, and its working fine. Now i need to do this for variable quantity and price. I am trying to base my design on this reference site. Basic tables I have created are: CREATE TABLE attribute ( attribute_id int(11) NOT NULL auto_in...

How to find foreign-key dependencies pointing to one record in Oracle?

Hi folks, I have a very large Oracle database, with many many tables and millions of rows. I need to delete one of them, but want to make sure that dropping it will not break any other dependent rows that point to it as a foreign key record. Is there a way to get a list of all the other records, or at least table schemas, that point to ...

Hibernate: Found: float, expected: double precision

I have a problem with the mapping of Oracle Float double precision datatype to Java Double datatype. The hibernate schema validator seems to fail when the Java Double datatype is used. org.hibernate.HibernateException: Wrong column type in DB.TABLE for column amount. Found: float, expected: double precision The only way to avoid this ...

How to design a database schema for storing text in multiple languages?

We have a PostgreSQL database. And we have several tables which need to keep certain data in several languages (the list of possible languages is thankfully system-wide defined). For example lets start with: create table blah (id serial, foo text, bar text); Now, let's make it multilingual. How about: create table blah (id serial, f...

What type of database schema should I use for storing and working with geolocation data?

I'm creating an application that will store geolocation data for specific transactions. Should I store a simple lat/long or is there a more preferred standard? What datatypes should I use to allow for switching to NoSQL in the future? ...

should this database table be normalized?

i have taken over a database that stores fitness information and we were having a debate about a certain table and whether it should stay as one table or get broken up into three tables. Today, there is one table called: workouts that has the following fields id, exercise_id, reps, weight, date, person_id So if i did 2 sets of 3 diffe...

Converting a Table in Oracle Database into an XML file

Hi, I need to create XML file, given a table/view in the Database. The actual requirement would be: The code has to get the table/view name as input parameter, read the schema of the same, create a corresponding XML file with the same structure as that of the table/view, and load the XML with the data of the table/view. Language preferr...

Reverse engineer an ORM

Given a [mysql] database with a given schema, is it possible to generate an ORM interface for it? doesn't matter if its php, python or perl. in other words, I have a database and I have to ask it a few questions. while I could just craft a bunch of SQL queries (okay, several dozen), this is way more interesting to think about. is this ...

Scalable way of doing self join with many to many table

I have a table structure like the following: user id name profile_stat id name profile_stat_value id name user_profile user_id profile_stat_id profile_stat_value_id My question is: How do I evaluate a query where I want to find all users with profile_stat_id and profile_stat_value_id for many stats? I've tried ...

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 type Microsoft.Data.Schema.Sql.SchemaModel.ISql100DatabaseEncryptionKey: The user does n...

Visual Studio 2010 Database Project does not understand Schema Names anymore?

I just tried to upgrade a Visual Studio 2008 Database project to VS2010 and actually it is quite a mess. Hundreds of warnings, all unsolved references. It seems to boil down to Visual Studio not to understand Schema Names (aka Ownership) anymore. For example, the default dbo schema: [$(MyDataBase)].dbo.MyTable is fine but: [$(MyDataB...

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 strategies to doing that? (i.e. I've created a 'Car' model and now I want to apply the appr...

Trying to convert existing production database table columns from enum to VARCHAR (Rails)

Hi everyone, I have a problem that needs me to convert my existing live production (I've duplicated the schema on my local development box, don't worry :)) table column types from enums to a string. Background: Basically, a previous developer left my codebase in absolute shit, migration versions are extremely out of date, and apparen...

How can i test my DB speed? (Learning)

I have design a database. Theres no columns with indexing, nor any code for optimizing. I am positive i should index certain columns since i search them a lot. My question is HOW do i test if any part of my database will be slow? ATM I am using sqlite and i will be switching to either MS Sql or MySql based on my host provider. Will crea...

Database with "Open Schema" - Good or Bad Idea?

The co-founder of Reddit gave a presentation on issues they had while scaling to millions of users. A summary is available here. What surprised me is point 3: Instead, they keep a Thing Table and a Data Table. Everything in Reddit is a Thing: users, links, comments, subreddits, awards, etc. Things keep common attribute like up/down...

What is the best schema design for child collection with a "primary" entity

Here is the scenario: You have a Persons table with a one-to-many relationship with an Addresses table, where one of the Address rows is the "primary" Address. Is it better in a normalized schema to Use a Persons.PrimaryAddressID to access the "primary" Address for a Person or Use an Addresses.IsPrimary bit column to reference th...

Creating and Indexing Email Database using SqlCe

I am creating a simple email client program. I am using MS SqlCe as a storage of emails. The database schema for storing the message is as follows: StorageId int IDENTITY NOT NULL PRIMARY KEY, FolderName nvarchar(255) NOT NULL, MessageId nvarchar(3999) NOT NULL, MessageDate datetime NOT NULL, StorageData ntext NULL In the StorageData ...