pub fn run(
config: &Config,
db_name: Option<&str>,
opts: GenerateOptions,
) -> Result<(), CliError>Expand description
Runs drizzle generate: diffs the schema files against the newest
snapshot.json in the migrations folder and writes
<out>/<tag>/migration.sql plus snapshot.json.
After a git merge leaves several open heads in the snapshot history, the
diff runs against the merged state of every branch instead (see
drizzle_migrations::history::load_merge_base) and the new snapshot’s
prevIds lists every head, as drizzle-kit does.
Prints a note and writes nothing when the schema has no tables or indexes
or nothing changed. With --custom, writes a migration.sql holding only
a comment and no snapshot, so the next diff ignores it. Also rewrites
migrations.js when bundling is enabled. Does not connect to the
database.
Ambiguous renames are asked about on a terminal and otherwise answered
from --hints / --hints-file; renames are never inferred (see
renames).
§Errors
Returns CliError if db_name does not match the config, the folder
still uses the legacy meta/_journal.json layout (run drizzle up), no
schema files are found or they have parse errors, merged migration
branches conflict (unless --ignore-conflicts or --fix-conflicts), a
conflicting migration folder cannot be deleted, the hints are invalid
(CliError::InvalidHints) or leave a rename question unanswered without
a terminal (CliError::MissingHints), a prompt is aborted, the diff
fails, or the migration folder cannot be written (including when its tag
already exists).