drizzle-seed uses versioning to manage outputs for static and dynamic data. To ensure true
determinism, ensure that values remain unchanged when using the same seed number. If changes are made to
static data sources or dynamic data generation logic, the version will be updated, allowing
you to choose between sticking with the previous version or using the latest.
You can upgrade to the latest drizzle-seed version for new features, such as additional
generators, while maintaining deterministic outputs with a previous version if needed. This
is particularly useful when you need to rely on existing deterministic data while accessing new functionality.
History
api version
npm version
Changed generators
v1
0.1.1
v2 (LTS)
0.2.1
string(), interval({ isUnique: true })
How it works under the hood?
This is not an actual API change; it is just an example of how we will proceed with drizzle-seed versioning.
For example, lastName generator was changed, and new version, V2, of this generator became available.
Later, firstName generator was changed, making V3 version of this generator available.
V1
V2
V3(latest)
LastNameGen
LastNameGenV1
LastNameGenV2
FirstNameGen
FirstNameGenV1
FirstNameGenV3
Use the firstName generator of version 3 and the lastName generator of version 2
If you are not ready to use latest generator version right away, you can specify max version to use
Use the firstName generator of version 1 and the lastName generator of version 2
Use the firstName generator of version 1 and the lastName generator of version 1.
Version 2
Unique interval generator was changed
Reason for upgrade
An older version of the generator could produce intervals like 1 minute 60 seconds and 2 minutes 0 seconds, treating them as distinct intervals.
However, when the 1 minute 60 seconds interval is inserted into a PostgreSQL database, it is automatically converted to 2 minutes 0 seconds. As a result, attempting to insert the 2 minutes 0 seconds interval into a unique column afterwards will cause an error
You will be affected, if your table includes a unique column of type interval:
PostgreSQL
You will be affected, if you use the unique interval generator in your seeding script, as shown in the script below:
PostgreSQL
MySQL
SQLite
string generators were changed: both non-unique and unique
Reason to upgrade
Ability to generate a unique string based on the length of the text column (e.g., varchar(20))
You will be affected, if your table includes a column of a text-like type with a maximum length parameter or a unique column of a text-like type:
PostgreSQL
MySQL
SQLite
You will be affected, if you use the string generator in your seeding script, as shown in the script below: