Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

How many parts should there be to a database? Schema, helper Adapter and so on everyone doe it a little different.

What is the best way to break down a database into separate file and what are the files called? When I look at examples they are all done a little different.

1 Answer

Steven Parker
Steven Parker
231,261 Points

I think it depends on the size of your project, there's no universal "best" way. For small databases, I can imagine all the schema saved in one file, and the data in another. As the data grows, you might want a separate data file for each table.

For a really huge system you might even save each component in separate file (for example, each table schema, each view schema, etc.).

You might want to name the files for their contents, with .sql extension. Like myschema.sql or products_table.sql.