My site allows users to post things on the site with an expiry date. Once the item has expired, it will no longer be displayed in the listings. Posts can also be closed, canceled, or completed. I think it would be be nicest just to be able to check for one attribute or status ("is active") rather than having to check for [is not expired,...
I have a bunch of boolean options for things like "acceptable payment types" which can include things like cash, credit card, cheque, paypal, etc. Rather than having a half dozen booleans in my DB, I can just use an integer and assign each payment method an integer, like so
PAYMENT_METHODS = (
(1<<0, 'Cash'),
(1<<1, 'Credit Card...
I want to save a user's IP address to my database just in case any legal issues come up and we need to track down who performed what action. Since I highly doubt I will ever actually need to use this data (well, maybe for counting unique hits or something) do you think I can just dump the REMOTE_ADDR into a field? If so, what should the ...
So, the modern concept of the buddy list:
Let's say we have a table called Person. Now, that Person needs to have many buddies (of which each buddy is also in the person class). The most obvious way to construct a relationship would be through a join table.
i.e.
buddyID person1_id person2_id
0 1 2
1 3 ...
What's a good way of naming date/datetime fields? Can't decide if I want to use things like expiry_date, end_time, created_on, or simply expires, modified.
...
Here's what I'm thinking (excuse the Django format):
class VehicleMake(Model):
name = CharField(max_length=50)
class VehicleModel(Model):
make = ForeignKey(VehicleMake)
name = CharField(max_length=50)
class VehicleYear(Model):
model = ForeignKey(VehicleModel) # or ManyToManyField
year = PositiveIntegerField()
Thi...
I am interested in suggestions for building an efficient and robust structure for indexing products in a new database I am building (i'm using MySql)
When a product is entered through the form there are three parts I am interested in indexing for searching purposes.
The product title
The product description
Tags
The most important ...
At the moment I'm doing this:
gems(id, name, colour, level, effects, source)
id is the primary key and is not auto-increment.
A typical row of data would look like this:
id => 40153
name => Veiled Ametrine
colour => Orange
level => 80
effects => +12 sp, +10 hit
source => Ametrine
(Some of you gamers might s...
I have a list management appliaction that stores its data in a many-to-many relationship database.
I.E. A note can be in any number of lists, and a list can have any number of notes.
I also can export this data to and XML file and import it in another instance of my app for sharing lists between users. However, this is based on a lega...
Is is possible in rails to setup on model which is dependant on a join from two tables? This would mean that for the the model record to be found/updated/destroyed there would need to be both records in both database tables linked together in a join. The model would just be all the columns of both tables wrapped together which may then b...
So, I'm trying to learn a lot at once, and this place is really helpful!
I'm making a little running log website for myself and maybe a few other people, and I have it so that the user can add workouts for each day. With each workout, I have a variety of information the user can fill out for the workout, such as running distance, time,...
I had been assigned to develop a system on where we would get a XML from multiple sources (millions of xml) and put them in some database like and judging from the xml i would receive, there wont be any concrete structure even if they are from the same source. With this reason i think i cannot suggest RDMS and currently looking at NoSQL ...
I'm creating a project tasklist application. I have project, section, task, issue classes, and would like to use one class to be able to add simple notes to any object instance of those classes.
The task, issue tables both use a standard identity field as a primary key.
The section table has a two field primary key.
The project table ...
I have an entity which has 4 different types of property that could have only one value for each case which are boolean, decimal, string or text. I don't want to define the table with 4 boolean, decimal, nvarchar and ntext columns. What would you recommend to cover this case?
Update:
I'm using MS SQL Server.
Here is the class definit...
Howdy!
So, per Mehrdad's answer to a related question, I get it that a "proper" database table column doesn't store a list. Rather, you should create another table that effectively holds the elements of said list and then link to it directly or through a junction table. However, the type of list I want to create will be composed of un...
What is the best way to maintain a unique ID field across multiple database tables?
My database contains both businesses and people, and both entities need to have a unique ID field associated with it. In addition, there are other tables (for example Addresses) which can reference either a business or a person using their ID as a foreig...
I am failing in creating tables via the PGadmin III SQL editor - even if the syntax is generated by the frontend:
CREATE TABLE testtable
(
id integer,
"name" character varying(100)
)
WITH (
OIDS = FALSE
)
;
Error message is in german, but basically says that there's supposed to be a syntax error..
FEHLER: Syntaxfehler bei ...
I have two tables called (Up|Down)Vote, you can do BOTH upvote and downvote thus it isnt one table with a bool. People suggested i should use one table called votes and have a field called type.
Why should i do this? I think writing the unique table name is easier then writing Vote then the extra where statement (type & upOrDownTypeBit)...
I'm designing a basic sports application in RoR and I don't know if my database design is correct. For instance, I have:
class Game < ActiveRecord::Base
has_one :home_team
has_one :away_team
end
class Team < ActiveRecord::Base
has_many :games
end
However, someone told me the better way to do this is:
class Game < ActiveRecord:...
This is probably very simple, but I'm quite new to ruby and active record.
I've got a CSV dump of a database which I'm trying to import to a database using DataMapper. I'm having trouble understanding which type of relationships I should define in the models so that it matches what is defined CSV.
Here's what data I've got from the CS...