DEV Community

Son Tran profile picture

Son Tran

Software engineer and indie founder with 15+ years of experience. Built Schemity: a native desktop ERD tool for developers who want their schema in Git, not someone else's cloud. Based in Hanoi, VN.

2 Week Community Wellness Streak
1 Week Community Wellness Streak
Eight Year Club
Writing Debut
Seven Year Club
Six Year Club
Five Year Club
Four Year Club
Three Year Club
Two Year Club
One Year Club
Natural Key vs Surrogate Key: Which One Should a Foreign Key Reference?

Natural Key vs Surrogate Key: Which One Should a Foreign Key Reference?

Comments 1
7 min read

Want to connect with Son Tran?

Create an account to connect with Son Tran. You can also sign in below to proceed if you already have an account.

Already have an account? Sign in
PostgreSQL Schema on CockroachDB: What It Refuses, What It Changes, and How to Check Yours

PostgreSQL Schema on CockroachDB: What It Refuses, What It Changes, and How to Check Yours

Comments 1
6 min read
MySQL Cannot Drop Index Needed in a Foreign Key Constraint: Which Fix to Use

MySQL Cannot Drop Index Needed in a Foreign Key Constraint: Which Fix to Use

Comments 1
7 min read
Soft Delete vs Archive Table: Which One Keeps Your Foreign Keys Working

Soft Delete vs Archive Table: Which One Keeps Your Foreign Keys Working

Comments 1
12 min read
PostgreSQL Rewrites Your CHECK Constraints: Which Schema Differences Are Real Drift

PostgreSQL Rewrites Your CHECK Constraints: Which Schema Differences Are Real Drift

Comments 1
10 min read
PostgreSQL DROP COLUMN: What It Refuses, and What It Drops Without a Warning

PostgreSQL DROP COLUMN: What It Refuses, and What It Drops Without a Warning

Comments
7 min read
PostgreSQL Unused Sequences: How to Find Them, and Which Ones Are Safe to Drop

PostgreSQL Unused Sequences: How to Find Them, and Which Ones Are Safe to Drop

1
Comments
9 min read
ON DELETE RESTRICT vs NO ACTION: What Changed in PostgreSQL 18, and What MySQL and SQL Server Do

ON DELETE RESTRICT vs NO ACTION: What Changed in PostgreSQL 18, and What MySQL and SQL Server Do

Comments
6 min read
pgvector vs MySQL VECTOR vs SQL Server VECTOR: Where Embeddings Can Be Searched, Not Just Stored

pgvector vs MySQL VECTOR vs SQL Server VECTOR: Where Embeddings Can Be Searched, Not Just Stored

Comments
7 min read
Mermaid vs PlantUML vs D2 for an ER Diagram in Your Docs: Where Each One Renders, and Where It Breaks

Mermaid vs PlantUML vs D2 for an ER Diagram in Your Docs: Where Each One Renders, and Where It Breaks

Comments
8 min read
TimescaleDB Foreign Keys and Hypertables: Which Directions Work, and Which One Breaks Retention

TimescaleDB Foreign Keys and Hypertables: Which Directions Work, and Which One Breaks Retention

Comments
7 min read
Should a Boolean Column Be Nullable? NULL vs DEFAULT false vs a Status Column

Should a Boolean Column Be Nullable? NULL vs DEFAULT false vs a Status Column

1
Comments
9 min read
OpenAPI Schemas From the Database: Which Parts to Generate and Which to Write by Hand

OpenAPI Schemas From the Database: Which Parts to Generate and Which to Write by Hand

Comments
8 min read
SQL Server DATETIME vs DATETIME2: Which to Use, and What Converting an Existing Column Costs

SQL Server DATETIME vs DATETIME2: Which to Use, and What Converting an Existing Column Costs

Comments
9 min read
Cloudflare D1 Schema Diagram: Draw It From the Local Wrangler File, an Export, or the Remote Database?

Cloudflare D1 Schema Diagram: Draw It From the Local Wrangler File, an Export, or the Remote Database?

Comments 1
11 min read
Checking Database Migrations in CI: What a Pull Request Check Can Catch Without a Database

Checking Database Migrations in CI: What a Pull Request Check Can Catch Without a Database

1
Comments 1
8 min read
Case-Insensitive Email in PostgreSQL: citext, a lower() Index, or a Nondeterministic Collation?

Case-Insensitive Email in PostgreSQL: citext, a lower() Index, or a Nondeterministic Collation?

Comments
8 min read
MySQL utf8mb3 to utf8mb4: What CONVERT TO CHARACTER SET Locks, Refuses and Silently Changes

MySQL utf8mb3 to utf8mb4: What CONVERT TO CHARACTER SET Locks, Refuses and Silently Changes

Comments
11 min read
Circular Dependencies Between Modules in a Database: A Real Dependency, or One Table in the Wrong Module?

Circular Dependencies Between Modules in a Database: A Real Dependency, or One Table in the Wrong Module?

Comments
11 min read
SQL Server Multiple Cascade Paths (Error 1785): Which Foreign Key Loses ON DELETE CASCADE, and What Replaces It

SQL Server Multiple Cascade Paths (Error 1785): Which Foreign Key Loses ON DELETE CASCADE, and What Replaces It

Comments
11 min read
MySQL ENUM vs CHECK Constraint: Which Value List Changes Copy the Table

MySQL ENUM vs CHECK Constraint: Which Value List Changes Copy the Table

Comments
10 min read
MariaDB to MySQL Migration: Which Schema Features Break, and How to Find Them First

MariaDB to MySQL Migration: Which Schema Features Break, and How to Find Them First

Comments 2
12 min read
PostgreSQL Composite Foreign Keys vs Row-Level Security: Which Keeps Tenants Apart?

PostgreSQL Composite Foreign Keys vs Row-Level Security: Which Keeps Tenants Apart?

2
Comments 4
8 min read
Transactional DDL in PostgreSQL, MySQL and CockroachDB: Which Failed Migrations Roll Back?

Transactional DDL in PostgreSQL, MySQL and CockroachDB: Which Failed Migrations Roll Back?

Comments
10 min read
Navicat Data Modeler Alternative: Database Design Software Without the Enterprise Edition

Navicat Data Modeler Alternative: Database Design Software Without the Enterprise Edition

Comments
12 min read
Visual Paradigm Alternative: Database Design Software Without the Modeling Suite

Visual Paradigm Alternative: Database Design Software Without the Modeling Suite

Comments
19 min read
MySQL ALTER TABLE: Which Changes Lock the Table, and How to Make One Fail Instead of Copying

MySQL ALTER TABLE: Which Changes Lock the Table, and How to Make One Fail Instead of Copying

Comments
11 min read
Laravel ERD: Draw It From the Migration Files or From the Database?

Laravel ERD: Draw It From the Migration Files or From the Database?

1
Comments 5
9 min read
pgvector: Embedding Column on the Table or a Separate Embeddings Table?

pgvector: Embedding Column on the Table or a Separate Embeddings Table?

2
Comments 2
9 min read
MySQL to PostgreSQL Schema Conversion: What Each Column Type Should Become, and What Silently Changes

MySQL to PostgreSQL Schema Conversion: What Each Column Type Should Become, and What Silently Changes

1
Comments
12 min read
MySQL Workbench Alternative: ER Diagrams Past 250 Tables

MySQL Workbench Alternative: ER Diagrams Past 250 Tables

Comments
10 min read
How to Track Schema Changes in PostgreSQL: DDL Logging, an Event Trigger or a Schema Snapshot

How to Track Schema Changes in PostgreSQL: DDL Logging, an Event Trigger or a Schema Snapshot

Comments
9 min read
How to Auto-Update an updated_at Column: MySQL ON UPDATE vs a Database Trigger vs the ORM

How to Auto-Update an updated_at Column: MySQL ON UPDATE vs a Database Trigger vs the ORM

Comments
10 min read
SQL Server INT to BIGINT Primary Key: Four Ways to Change It and What Each One Costs

SQL Server INT to BIGINT Primary Key: Four Ways to Change It and What Each One Costs

Comments
11 min read
Round-Tripping TPC-DS and a Snowflake Feature Schema Through a Database Diagram: What Snowflake Lost and What We Fixed

Round-Tripping TPC-DS and a Snowflake Feature Schema Through a Database Diagram: What Snowflake Lost and What We Fixed

Comments
13 min read
Round-Tripping Campfire and Jellyfin Through a Database Diagram: What SQLite Lost and What We Fixed

Round-Tripping Campfire and Jellyfin Through a Database Diagram: What SQLite Lost and What We Fixed

Comments
13 min read
Round-Tripping Bitwarden and Smartstore Through a Database Diagram: What SQL Server Lost and What We Fixed

Round-Tripping Bitwarden and Smartstore Through a Database Diagram: What SQL Server Lost and What We Fixed

Comments
15 min read
Round-Tripping Invoice Ninja and Sylius Through a Database Diagram: What MySQL Lost and What We Fixed

Round-Tripping Invoice Ninja and Sylius Through a Database Diagram: What MySQL Lost and What We Fixed

Comments
15 min read
Round-Tripping Mastodon and Saleor Through a Database Diagram: What Broke and What We Fixed

Round-Tripping Mastodon and Saleor Through a Database Diagram: What Broke and What We Fixed

Comments
18 min read
MySQL UNSIGNED Primary Keys: Signed or Unsigned, and How to Fix Error 3780 When They Mix

MySQL UNSIGNED Primary Keys: Signed or Unsigned, and How to Fix Error 3780 When They Mix

Comments 2
12 min read
Foreign Keys Between Modules in a Modular Monolith: Keep, Restrict, or Drop?

Foreign Keys Between Modules in a Modular Monolith: Keep, Restrict, or Drop?

Comments
10 min read
PostgreSQL: Changing an Integer Column to Boolean - In Place or a New Column, and the Four Errors on the Way

PostgreSQL: Changing an Integer Column to Boolean - In Place or a New Column, and the Four Errors on the Way

Comments
10 min read
What Breaks When a Database Diagram Reaches 1,000 Tables, and What We Redesigned

What Breaks When a Database Diagram Reaches 1,000 Tables, and What We Redesigned

Comments
13 min read
PostgreSQL Constraint Naming Convention: Which Pattern to Use, and How to Find the Names That Drifted

PostgreSQL Constraint Naming Convention: Which Pattern to Use, and How to Find the Names That Drifted

Comments
8 min read
PostgreSQL: Cannot Alter Type of a Column Used by a View - How to Change It, and How to Find Every View in the Way

PostgreSQL: Cannot Alter Type of a Column Used by a View - How to Change It, and How to Find Every View in the Way

Comments
9 min read
PostgreSQL serial vs identity: Which to Use, and How to Convert Old serial Columns

PostgreSQL serial vs identity: Which to Use, and How to Convert Old serial Columns

Comments
9 min read
Database MCP Server: Should an AI Agent Run SQL or Only Read the Schema?

Database MCP Server: Should an AI Agent Run SQL or Only Read the Schema?

Comments
7 min read
Changing a Column Type in SQLite: The Table Rebuild and What It Deletes

Changing a Column Type in SQLite: The Table Rebuild and What It Deletes

Comments
8 min read
ON DELETE SET NULL vs CASCADE vs RESTRICT in PostgreSQL: Which to Use

ON DELETE SET NULL vs CASCADE vs RESTRICT in PostgreSQL: Which to Use

Comments
8 min read
A PostgreSQL Role That Reads the Schema but Not the Data: What to Grant

A PostgreSQL Role That Reads the Schema but Not the Data: What to Grant

Comments
8 min read
Adding a NOT NULL Column to a Large PostgreSQL Table: Constant Default, Backfill or NOT VALID

Adding a NOT NULL Column to a Large PostgreSQL Table: Constant Default, Backfill or NOT VALID

1
Comments
10 min read
PostgreSQL numeric vs double precision vs money: Which Type to Use for Prices

PostgreSQL numeric vs double precision vs money: Which Type to Use for Prices

Comments 1
9 min read
PostgreSQL Generated Column vs Trigger: Which to Use for a Derived Column

PostgreSQL Generated Column vs Trigger: Which to Use for a Derived Column

Comments
10 min read
PostgreSQL Unique Constraint vs Unique Index: Which to Use, and How to Add One Without Locking the Table

PostgreSQL Unique Constraint vs Unique Index: Which to Use, and How to Add One Without Locking the Table

Comments
9 min read
Polymorphic Associations in PostgreSQL: One commentable_id Column or a Foreign Key per Table?

Polymorphic Associations in PostgreSQL: One commentable_id Column or a Foreign Key per Table?

Comments
7 min read
Column Comments in PostgreSQL and MySQL: How to Document Columns Without a Migration

Column Comments in PostgreSQL and MySQL: How to Document Columns Without a Migration

Comments 1
7 min read
Circular Foreign Keys: Why the First Row Cannot Be Inserted

Circular Foreign Keys: Why the First Row Cannot Be Inserted

Comments
10 min read
PostgreSQL timestamp vs timestamptz: Which to Use and How to Find the Wrong Ones

PostgreSQL timestamp vs timestamptz: Which to Use and How to Find the Wrong Ones

Comments
8 min read
Export a Database Data Dictionary: HTML, Markdown and Excel from Your ERD

Export a Database Data Dictionary: HTML, Markdown and Excel from Your ERD

Comments
7 min read
Schema Linting vs Migration Linting: Which Database Problems Each One Can See

Schema Linting vs Migration Linting: Which Database Problems Each One Can See

Comments
11 min read
loading...