Skip to content

support paths in file_template #1774

Description

@zzzeek

Discussed in #1772

if I make a file_template like this:

file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d%%(second).2d_%%(rev)s_%%(slug)s

it should Just Work

so this means:

  1. in script/base.py in generate_revision() there should be a self._ensure_directory() for the final calculated path of the output file
  2. the alembic.ini.mako / pyproject.toml.mako templates should include an additional example with a line like the above, as well as in tutorial.rst editing-the-ini-file
  3. the bulletpoint in editing-the-ini-file for file_template also needs a new paragraph /example for this with a .. versionadded:: directive afterwards.
  4. all of 2,3 above also need to mention that recursive_version_locations=true must be set
  5. tests in tests/test_script_produciton.py. generation of new file with directory scheme, use a mocked datetime, check for directory path exists, then test creating a ScriptDirectory against it and the new file is loctable

Metadata

Metadata

Assignees

No one assigned

    Labels

    use casenot quite a feature and not quite a bug, something we just didn't think ofversioning model

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions