-
Notifications
You must be signed in to change notification settings - Fork 0
Database: Add Merise data models diagrams (MCD, MLD) #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f8e55be
Add Mocodo to generate MCD and MLD diagrams
ebouchut 6816dac
docs(db): Add a section about Merise database diagrams (MCD, MLD, MPD)
ebouchut d1969bc
docs: use branch-aware links for merise diagrams
Copilot 6b2b99c
docs: make merise diagram links branch-agnostic
Copilot 43fa2fc
docs: Fix brolen links to Merise data model diagrams
ebouchut af06d9a
docs: Remove conflict markers and reorder diagram links
ebouchut ed41e9c
docs: Fix docs, Makefile targets, folders and install commands
ebouchut a535cb2
docs: Move description of Merise diagrams to dedicated sections
ebouchut 8459e02
docs: Unshift heading-level of database sections
ebouchut 4157a28
docs: Clarify database diagrams docs and fix typos
ebouchut f63ae45
docs: Fix MLD description
ebouchut 5f2eea8
docs: Move "Database Schema" section
ebouchut 8d2a840
docs: Remove a note about frontend naming convention
ebouchut 6bb5093
docs: Add a description for snake_case naming
ebouchut bf27d60
chore(docs): require TBLS_DSN and update tbls install docs
ebouchut 0e83c98
docs: Fix typos
ebouchut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Ignore existing files with the same name as phony targets | ||
| .PHONY: help diagrams mcd mld mpd ddl clean | ||
|
|
||
| # Default make target used if none specified | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| # Display the syntax with available targets | ||
| help: | ||
| @echo "Available targets:" | ||
| @echo " make diagrams — generate MCD, MLD, and MPD" | ||
| @echo " make mcd — generate MCD" | ||
| @echo " make mld — generate MLD" | ||
| @echo " make mpd — generate MPD" | ||
| @echo " make ddl — regenerate DDL (SQL with Postgres database structure)" | ||
| @echo " make clean — remove generated diagrams" | ||
|
ebouchut marked this conversation as resolved.
|
||
|
|
||
| # Generate all database diagrams (MCD, MLD, MPD) | ||
| diagrams: mcd mld mpd | ||
| @echo "All diagrams generated (MCD, MLD, MPD)" | ||
|
|
||
| # Generate MCD from Mocodo source | ||
| mcd: | ||
| @echo "Generating MCD..." | ||
| mocodo --input docs/database/mcd/learn-dev.mcd --output_dir docs/database/mcd --colors brewer+1 | ||
| @echo "MCD generated in docs/database/mcd/" | ||
|
|
||
| # Generate MLD (2 step process): | ||
| # - transform MCD source into a MLD source: docs/database/mld/learn-dev_mld.mcd | ||
| # - Render the MLD source | ||
| mld: | ||
| @echo "Generating MLD..." | ||
| mocodo --input docs/database/mcd/learn-dev.mcd --output_dir docs/database/mld --transform mld diagram | ||
| rm -f docs/database/mld/learn-dev.* | ||
| mocodo --input docs/database/mld/learn-dev_mld.mcd --output_dir docs/database/mld --colors ocean | ||
| @echo "MLD generated in docs/database/mld/learn-dev_mld.svg" | ||
|
|
||
| # Generate MPD from the PostgreSQL database | ||
| mpd: | ||
| @echo "Generating MPD from PostgreSQL Database..." | ||
| @mkdir -p docs/database/mpd | ||
| @test -n "$(TBLS_DSN)" || (echo "TBLS_DSN is required (e.g., postgres://user:pass@host:5432/dbname)" >&2; exit 1) | ||
| tbls doc "$(TBLS_DSN)" docs/database/mpd --force | ||
| @echo "MPD generated in docs/database/mpd/" | ||
|
ebouchut marked this conversation as resolved.
ebouchut marked this conversation as resolved.
ebouchut marked this conversation as resolved.
ebouchut marked this conversation as resolved.
Comment on lines
+38
to
+43
|
||
|
|
||
| # Generate a SQL file to create the database structure (tables, associations) | ||
| # (with Postgres DDL syntax) | ||
| ddl: | ||
| @echo "Generating DDL (Postgres SQL syntax)..." | ||
| @mkdir -p docs/database/ddl | ||
| mocodo --input docs/database/mcd/learn-dev.mcd --output_dir docs/database/ddl -t postgres | ||
| @echo "DDL generated in docs/database/ddl/" | ||
|
ebouchut marked this conversation as resolved.
|
||
|
|
||
| # Clean up generated diagram files | ||
| clean: | ||
| @echo "Cleaning up generated diagrams..." | ||
| rm -f docs/database/mcd/learn-dev.svg | ||
| rm -f docs/database/mcd/learn-dev_geo.json | ||
| rm -f docs/database/mld/* | ||
| rm -f docs/database/mpd/* | ||
| rm -f docs/database/ddl/* | ||
| @echo "Cleaned" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| % learn-dev MCD (Modele Conceptuel des Données). | ||
| % This text file uses Mocodo-syntax to describe the MCD. | ||
| % | ||
| % See: | ||
| % - GitHub Repository: https://github.com/laowantong/mocodo | ||
| % - Syntax: https://laowantong.github.io/mocodo/doc/fr_refman.html#Syntaxe-de-description-d'un-MCD | ||
| % Usage: | ||
| % mocodo --input docs/database/mcd/learn-dev.mcd --output_dir docs/database/mcd --colors brewer+1 | ||
|
|
||
| : | ||
| Email Token: token_id, token, expires_at, used_at | ||
| Audit Log: log_id, action_type, entity_type, entity_id, description, ip_address, user_agent, was_successful, error_message, metadata | ||
| : | ||
|
|
||
| Reset Token: token_id, token, expires_at, used_at, ip_address | ||
| Receives, 11 Email Token, 0N User | ||
| Performs, 01 Audit Log, 0N User | ||
| : | ||
|
|
||
| Requests, 11 Reset Token, 0N User | ||
| User: user_id, username, email, password, first_name, last_name, is_active, is_verified, is_locked, failed_login_attempts, last_login_at, password_changed_at | ||
| Holds, 0N User, 0N Role : assigned_at, assigned_by | ||
| Role: role_id, role_name, description, is_active | ||
|
|
||
| : | ||
| Owns, 11 Refresh Token, 0N User | ||
| Refresh Token: token_id, token, expires_at, revoked_at, revoked_reason, ip_address, user_agent, last_used_at | ||
| : |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.