I am going through my database and what I want to do is re-design it because I feel like it's very messy and that I am doing it wrong. This is just for practice; I've never had anyone teach me so I would love to learn new ways and how to approach this.
What I have is a users table with the following fields:
id, admin, active, username, password, business_name, address, city, state, zip, phone, email, hours, hours2, credit_cards, logo_ext, package, theme, header_image, facebook_link, twitter_link, analytics, analytics_id, website_url, banner_image, member_forgot, home_page, about_page, contact_page
Wow, pretty messy right? Here are a few things I see:
admin and active is just a bunch of 0's and 1's so can I do something like this? Since there will be 99% active and only a couple that will be inactive.
admin - id, user_id
inactive - id, user_id
social - id, user_id, facebook_link, twitter_link
member_forgot - id, user_id, forgot_code
I'm not too sure about the rest. Just to explain a few of the fields:
- Hours = Monday through Friday hours
- Hours2 = Saturday hours
- Credit_Cards = 1110 format (visa, mastercard, discover, amex)
- logo_ext = jpg, png - stores it when you upload logo
- package = 1, 2, or 3. Different level. Each level has its own template.
- theme = what stylesheet to use
- header_image = which image to use on the header for that account.
- analytics_id = I use piwik, so piwik stores a unique id that I need to store
- banner_image = 1-30 of different images there are to choose from
- pages = stores the text in the database, which they can change via wysiwyg editor.
I really want to practice splitting it up in different tables even if it is not a huge database, or is that a bad idea? So if I delete a user from the users table, it will delete all of the other records in the other tables associated with that user_id?
Any suggestions / help is appreciated. I love to learn new things and am very interested in making this database more efficient and flexible.
Thanks so much.