A Post belongs_to a User, and a User has_many Posts.
A Post also belongs_to a Topic, and a Topic has_many Posts.
class User < ActiveRecord::Base
has_many :posts
end
class Topic < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
belongs_to :topic
end
Well, that's pretty simple and very...
GUID is not an official data type in database. In our existing SQL Server design, the Uniqueidentifier type is used for GUID value. Now we are switching to Sybase database. Should we use varchar(36) to replace that Uniqueidentifier type?
I am still confused by GUID. I was told GUID is 16 bytes long but its character string is 36 charact...
Are soft deletes a good idea or a bad idea?
Instead of actually deleting a record in your database, you would just flag it as "IsDeleted" = true, and upon recovery of the record you could just flag it as "False".
Is this a good idea?
EDIT: this might be a better idea??? what about physically deleting the record then moving it to a ext...
Hi, I am currently planning to develop a music streaming application. And i am wondering what would be better as a primary key in my tables on the server. An ID int or a Unique String.
Methods 1:
Songs Table:
SongID(int), Title(string), Artist*(string), Length(int), Album*(string)
Genre Table
Genre(string), Name(string)
SongGenre...
I want to build an application that utilizes the data from a server, and it needs to synchronize the data in the application with the data entered by other client applications.
So, there are some questions:
How to design the database schema efficiently? Should it replicate the same database schema on the server or should it add some m...
I'm moving an existing MySQL based application over to Cassandra. So far finding the equivalent Cassandra data model has been quite easy, but I've stumbled on the following problem for which I'd appreciate some input:
Consider a MySQL table holding millions of entities:
CREATE TABLE entities (
id INT AUTO_INCREMENT NOT NULL,
entity...
I have a windows form application that uses microsoft access for the database on the backend.
When I run that application I get an error that says access is not installed on the computer. I thought that if I included the reference that it will be included with what I release so the user would not have to have access installed.
How...
I have 2 tables that their rows have one on one relation..
For you to understand the situation, suppose there is one table with user informations
and there is another table that contains a very specific informations and each user can only link to one these specific kind of informations ( suppose second table as characters )
And that cha...
I periodically ponder how to best design an application whose every business rule exists in just a single location. (While I know there is no proverbial “best way” and that designs are situational, people must have a leaning toward one practice or another.) I work for a shop where they prefer to house as much of the business rules as p...
I have the following tables:
user (userid int [pk], name varchar(50))
action (actionid int [pk], description nvarchar(50))
being referenced by another table that captures the relationship:
<user1> <action>'s <user2>.
I did this with the following table:
userAction (userActionId int [pk], actionid int [fk: action.actionid], **us...
I was planning to use db4o for a website. It's a microblog site with small posts and comments developed in java.
The thing is I contacted db4o support asking if db4o would be suitable for a website, and they answered me that only for websites with low concurrency. That means with few requests?
So, now I think db4o will not be a good...
What would be the best database design for employee clocking and out? Right now I have two tables.
Employee Base Table: Employee Id, relevant information like name and address, clocked in column
Employee Clocked in Table: Employee id, clock in date, Clock in Time, Clocked Out Time.
Is this a good way to track clocked in and clocked ou...
This is a fairly common problem, it probably has a name, I just don't know what it is.
A.) User sees obscure piece of information in Row B of L_OBSCURE_INFO displayed on some screen at a certain point. It is in table L_Obscure_info.
B.) Under certain circumstances we want to correctly delete data in L_OBSCURE_INFO. Unfortunately, nobod...
I'm looking into implementing OpenID, but I drawing a blank as to how the database would look with new / existing users. How does stackoverflow do it? I understand the concept that an external site does the authentication for me, but as far as storing user information on my end I need help with.
...
I'd like to store additional data if a particular value is chosen in the enumerated or looked-up column in a table. The obvious option is to have an extra column in the table, but this will lead to a mostly empty column and seems to be like bad approach. Is there another option/method of doing this?
...
I got a project of designing a Database. This is going to be my first big scale project. Good thing about it is information is mostly organized & currently stored in text files. The size of this information is 50GB. There are going to be few millions of records in each Table. Its going to have around 50 tables. I need to provide a web in...
I am using MySQL.
I have several lookups like this:
SELECT * from users WHERE user_name LIKE '%search_term%'
What index do I need to make these lookups fast?
...
Imagine this case, but with a lot more component buckets and a lot more intermediates and outputs. Many of the intermediates are calculated at the detail level, but a few things are calculated at the aggregate level:
DECLARE @Profitability AS TABLE
(
Cust INT NOT NULL
,Category VARCHAR(10) NOT NULL
,Income DECIMAL(10, ...
For instance, let's say I have a User model. Users have things like logins, passwords, e-mail addresses, avatars, etc. But there are two types of Users that will be using this site, let's say Parents and Businesses. I need to store some different information for the Parents (e.g. childrens' names, domestic partner, salaries, etc.) than f...
Hi,
I am required to work on a php project that requires the database to cater to multiple users. Generally, the idea is similar to what they have for carbonmade or basecamp, or even wordpress mu. They cater to multiple users, whom are also owners of their accounts. And if they were to cancel/terminate their account, anything on the pag...