# Diseño de Base de Datos

## Normalizaciones

### Nombres de Tablas

Definí todos los nombres de tablas en plural y en inglés. Ej.: `sales`, `products`, `contacts`.

### Claves Primarias

El campo de clave primaria de todas las tablas siempre debe llamarse `id` y ser del tipo `bigserial`, que es básicamente un BIGINT ligado a un sequence.

Aunque un diseño normalizado correctamente demande una clave primaria compuesta, como el caso de las tablas de relación mucho a mucho, mantené la recla del PK `id`. Esto viabiliza la automatización de muchas funciones de modelado del framework que usamos constantemente.

### Nombres de Claves Foráneas

Las claves foráneas de llamarse siempre como el nombre de la tabla referenciada en singular y con el sufijo `_id`. Ejemplos: `sale_id`, `product_id`, `contact_id`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.bims.xyz/diseno-de-base-de-datos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
