chore(db): add local PostgreSQL Compose setup
This commit is contained in:
@@ -1,21 +1,29 @@
|
||||
# Next.js template
|
||||
# Fluxent Web
|
||||
|
||||
This is a Next.js template with shadcn/ui.
|
||||
## 本地开发
|
||||
|
||||
## Adding components
|
||||
|
||||
To add components to your app, run the following command:
|
||||
需要已安装 Docker 和 pnpm。在项目目录执行:
|
||||
|
||||
```bash
|
||||
npx shadcn@latest add button
|
||||
pnpm install
|
||||
test -f .env.local || cp .env.example .env.local
|
||||
docker compose up -d
|
||||
docker compose ps
|
||||
pnpm db:logs
|
||||
pnpm drizzle-kit push --force
|
||||
```
|
||||
|
||||
This will place the ui components in the `components` directory.
|
||||
数据库镜像通过 `registry1.fw.ac.cn/docker.io/` 代理拉取最新的
|
||||
PostgreSQL Alpine 版本。
|
||||
|
||||
## Using components
|
||||
`pnpm db:logs` 会持续显示数据库日志,可按 `Ctrl-C` 返回终端。数据库停止后仍会保留命名卷中的数据:
|
||||
|
||||
To use the components in your app, import them as follows:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@/components/ui/button";
|
||||
```bash
|
||||
pnpm db:down
|
||||
```
|
||||
|
||||
如需有意删除数据库及全部数据,执行以下命令。此操作不可恢复:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user