Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
tblsの紹介@PHP_オレ_カンファレンス神戸
Search
sho44
July 21, 2024
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
tblsの紹介@PHP_オレ_カンファレンス神戸
sho44
July 21, 2024
More Decks by sho44
See All by sho44
PHPのバージョンアップを通して保守性の大切さを学んだ
shosho44
0
110
rettyインターン内容.pdf
shosho44
0
74
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Fireside Chat
paigeccino
43
4.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
460
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Embracing the Ebb and Flow
colly
88
5.2k
We Are The Robots
honzajavorek
0
400
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
GraphQLとの向き合い方2022年版
quramy
50
15k
Transcript
tblsの紹介
sho44 新卒2年目エンジニア 媒体サイドの広告管理画面作ってます 普段はRails, AWS, postgresql 学生時代インターンでPHP (CodeIgniter) (副業先探してます!) 自己紹介
xにとびます
tblsの紹介
tbls ( is pronounced /ˈteɪbl̩z/. ) is a CI-Friendly tool
for document a database, written in Go. https://github.com/k1LoW/tblsより引用
Go製なんかい! DBドキュメントツールなんかい!
PHPの話じゃなくて ごめんなさい!! 寛大な気持ちで聞いてください🧚
tblsのすごいところ • 環境構築がとても楽 • 一瞬でER図付きのDBドキュメントを作ってくれる • CIでDBのdiffを出してくれる • ネットワークに接続しなくても良い(はず) •
対応しているDBが多い ◦
デモ動画の前提条件 • 使用DB:postgresql • docker composeで環境作っています ◦ dbコンテナ、tblsコンテナのみ https://github.com/shosho44/tbls-introductionにデモ環境を載せています
デモ動画 https://www.youtube.com/watch?v=jx4VwKDGR8s
デモ動画 https://www.youtube.com/watch?v=VWHoB_vhbpg
version: "3.9" services: db: image: postgres:14.11 volumes: - data:/var/lib/postgresql/data environment:
POSTGRES_DB: db POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres healthcheck: test: "psql -U postgres -l" interval: 1s timeout: 1s retries: 5 ports: - "5432:5432" networks: - net_internal - net_external tbls: image: ghcr.io/k1low/tbls:latest working_dir: /mnt tty: true depends_on: db: condition: service_healthy volumes: - ./docs:/mnt entrypoint: tbls doc --rm-dist postgres://postgres:postgres@db:5432/postgre s?sslmode=disable networks: - net_internal volumes: data: networks: net_internal: name: net_internal internal: true net_external: name: net_external
他にも色々できます その1 $ tbls lint users.username: column comment required. users.password: column
comment required. comments.post_id: column comment required. posts: too many columns. [12/10] comments: too many columns. [11/10] 5 detected DBに対してlintを適用
他にも色々できます その2 $ tbls coverage Table Coverage All tables 16.1% public.users
20% public.comments 14.3% public.post_comments 87.5% public.post_comment_stars 0% DBのcommentなどの カバレッジ計測
他にも色々できます その3 • yamlファイルに定義するだけで、、、 ◦ 外部キーがはられていない tableのリレーションを定義できる ◦ カラム・DBにコメントを定義できる ◦ ALTER,
Migrationする必要がない!
利用シーン • 新人が入ってきたけどDBのカラムの説明や関連付けについて説明するのが大 変 • SQLを叩くBizメンバーからER図を欲しいと言われた • 使ってないテーブルやカラムのお掃除をしたいけどDBの全体像を把握できない
おわり