Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/erd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ERD Build
on:
push:
branches: [ "main" ]

jobs:
build-erd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Generate ER Diagrams
run: npx @liam-hq/cli erd build --input schema.sql --format postgres

# - Next step: Deploy ERD `./dist` to your preferred hosting service for easy sharing and access.
Empty file added dist/.keep
Empty file.
Binary file added dist/assets/favicon-C1fIBOxA.ico
Binary file not shown.
1 change: 1 addition & 0 deletions dist/assets/index-B3CmlIx1.css

Large diffs are not rendered by default.

312 changes: 312 additions & 0 deletions dist/assets/index-abgf_XNu.js

Large diffs are not rendered by default.

Binary file added dist/assets/liam_erd-D7Xv9-I9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/liam_erd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="./assets/favicon-C1fIBOxA.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Liam ERD</title>
<meta property="og:image" content="./assets/liam_erd-D7Xv9-I9.png" />
<script type="module" crossorigin src="./assets/index-abgf_XNu.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-B3CmlIx1.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
267 changes: 267 additions & 0 deletions dist/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"tables": {
"lesson": {
"name": "lesson",
"columns": {
"id": {
"name": "id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"title": {
"name": "title",
"type": "varchar",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"description": {
"name": "description",
"type": "text",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"topic": {
"name": "topic",
"type": "varchar",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"difficulty": {
"name": "difficulty",
"type": "varchar",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"order_index": {
"name": "order_index",
"type": "int4",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
}
},
"comment": null,
"indexes": {},
"constraints": {}
},
"task": {
"name": "task",
"columns": {
"id": {
"name": "id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"lesson_id": {
"name": "lesson_id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"title": {
"name": "title",
"type": "varchar",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"description": {
"name": "description",
"type": "text",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"schema_definition": {
"name": "schema_definition",
"type": "text",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"solution_query": {
"name": "solution_query",
"type": "text",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"order_index": {
"name": "order_index",
"type": "int4",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
}
},
"comment": null,
"indexes": {},
"constraints": {}
},
"users": {
"name": "users",
"comment": null,
"columns": {
"id": {
"name": "id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"github_username": {
"name": "github_username",
"type": "varchar",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"avatar_url": {
"name": "avatar_url",
"type": "text",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": false,
"comment": null
},
"progress": {
"name": "progress",
"type": "int4",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
}
},
"indexes": {
"idx_users_github_username": {
"name": "idx_users_github_username",
"unique": false,
"columns": [
"github_username"
],
"type": "btree"
}
},
"constraints": {}
},
"task_example_data": {
"name": "task_example_data",
"columns": {
"id": {
"name": "id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"task_id": {
"name": "task_id",
"type": "int8",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"example_data": {
"name": "example_data",
"type": "jsonb",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"default": null,
"check": null,
"primary": false,
"unique": false,
"notNull": true,
"comment": null
}
},
"comment": null,
"indexes": {},
"constraints": {}
}
},
"relationships": {},
"tableGroups": {}
}
34 changes: 34 additions & 0 deletions docs/README2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Архитектурная визуализация (liam)

## ERD: Архитектурная диаграмма БД

[![View ERD Online](https://img.shields.io/badge/ERD--View%20Online-brightgreen?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHJ4PSIzIiBmaWxsPSIjM2E4YmZmIi8+PHBhdGggZD0iTTUgN0gxMVY5SDVaIiBmaWxsPSJ3aGl0ZSIvPjxjaXJjbGUgY3g9IjgiIGN5PSI0IiByPSIxIiBmaWxsPSJ3aGl0ZSIvPjxjaXJjbGUgY3g9IjgiIGN5PSIxMiIgcj0iMSIgZmlsbD0id2hpdGUiLz48L3N2Zz4=)](https://liambx.com/erd/p/github.com/linskay/space-sql/blob/master/schema.sql)

### Как посмотреть ERD-диаграмму локально

1. Сгенерируй актуальную схему:
```sh
mvn process-resources
npx @liam-hq/cli erd build --input schema.sql --format postgres
```
2. Запусти локальный сервер в папке dist:
```sh
npx http-server dist/
```
3. Открой [http://localhost:8080](http://localhost:8080) (или другой свободный порт) в браузере.

---

- Вся визуализация лежит в папке `dist/` (создаётся автоматически).
- Для документации или wiki можно сделать скриншот ERD или экспортировать SVG.

### Структура папок

- `dist/` — интерактивная ERD-диаграмма (всё, что нужно для просмотра через http-server)
- `docs/README2.md` — инструкция по запуску и использованию ERD
- `schema.sql` — актуальная схема БД (генерируется автоматически)

---
- Файл `schema.sql` всегда актуализируется автоматически через Liquibase.
- Для работы нужен Node.js и npm (см. инструкции выше).
- Если возникнут ошибки — смотри логи или обратись к команде.
45 changes: 41 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>

<!-- Development Tools -->
<dependency>
Expand Down Expand Up @@ -99,6 +95,47 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Liquibase plugin для генерации migrate.sql -->
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>4.24.0</version>
<configuration>
<changeLogFile>src/main/resources/db/changelog/db.changelog-master.xml</changeLogFile>
<url>jdbc:postgresql://localhost:5432/space_sql</url>
<username>admin</username>
<password>1111</password>
<driver>org.postgresql.Driver</driver>
<outputFile>target/liquibase/migrate.sql</outputFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>updateSQL</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-schema</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy file="target/liquibase/migrate.sql" tofile="schema.sql" overwrite="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading