Openstreetmap-website/Database schema
This is Developer documentation on how the various database tables are laid out in OpenStreetMap's core rails app, Openstreetmap-website. This database stores all data relating directly to the OpenStreetMap website and API, and most importantly the geodata tables hold the actual map data, that is the Data Primitives (nodes/ways/relations/tags etc) and their editing history.
Schema changes are carried out occasionally in form of rails "migrations", and so the migrations definitions in git should be regarded as the "one true source" for schema definitions. In fact there is, at least in theory, little need to understand the underlying database schema, since code interactions within rails app take place via the rails models (ActiveRecord), and data interactions by third party tools take place via the API. However, if you're developing on your own test server, you may be curious to know how the underlying database is structured.
The latest version of the database schema can be found in the openstreetmap-website git repository.
A detailed ER Diagram of the schema supporting the RailsPort can be found here (created 12/2014)
Tables
Geodata tables
There are two tables for each set of Data Primitives: the master table and the current table.
The current table (e.g. 'current_nodes', 'current_ways') is the latest revision, used for drawing the map. The master table includes all previous edit history. The current table is therefore a subset of the master table.
Latitude and Longitude are stored as scaled integers with a scale factor of 1e7, so an integer latitude of -412870685 equates to -41.2870685.