summaryrefslogtreecommitdiff
path: root/Documentation/source/operations/database.rst
blob: 37c0cba3e29a972b00c1e51f1ef7e7351b856baa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Database
========

Local Bootstrap
---------------

Use the included helper when developing locally:

.. code-block:: bash

   ./start-database.sh

The script is designed for local development and should not be used as a
production database management tool.

Schema Areas
------------

.. list-table::
   :header-rows: 1
   :widths: 24 50

   * - Area
     - Ownership
   * - Payload schema
     - CMS collections, admin content, media metadata, and Payload-managed
       structures.
   * - Drizzle ``blog_*`` tables
     - better-auth users, sessions, accounts, verifications, comments, rates,
       and roles.

Migration Workflow
------------------

For Payload collection changes:

.. code-block:: bash

   pnpm payload:migrate:create
   pnpm payload:migrate
   pnpm payload:generate

For application schema changes:

.. code-block:: bash

   pnpm db:generate
   pnpm db:migrate

During local iteration, ``pnpm db:push`` can be useful, but committed schema
changes should still have a deliberate migration story.

Operational Cautions
--------------------

* Keep Payload and application-owned tables conceptually separate.
* Regenerate Payload types after collection changes.
* Keep ``drizzle.config.ts`` filters aligned with application-owned tables.
* Do not commit local database data directories or generated build artifacts.