Vincent Tang Profile picture
👨‍💻 Developer 🧗 Rock Climber 🎤 Occasional Speaker 📚 Likes to learn new things ✍️ Blogging @vincentntang.com
23 Sep 19
TIL there's lots of ways of #seeding #fakedata into a #SQL #database. You can either

A. Seed it with purely random data all the way
B. Seed it with realistic data
C. Seed it initially with random data, but tie that data into other tables realistically
When you seed a database, you start off with enum (that's like a dictionary that doesn't change in size). If you look at a database schema, it's the tables that are only connected one time.

Then you focus on tables that have only have 1 foreign key tied, tied to an enum
Example with a basic HR database schema. Start seeding the outlier tables first, starting with the bottom-left most and bottom-right most tables, followed by bottom-middle.
Read 11 tweets