alembic.ini.mako 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # a multi-database configuration.
  2. [alembic]
  3. # path to migration scripts.
  4. # this is typically a path given in POSIX (e.g. forward slashes)
  5. # format, relative to the token %(here)s which refers to the location of this
  6. # ini file
  7. script_location = ${script_location}
  8. # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
  9. # Uncomment the line below if you want the files to be prepended with date and time
  10. # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
  11. # for all available tokens
  12. # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
  13. # sys.path path, will be prepended to sys.path if present.
  14. # defaults to the current working directory. for multiple paths, the path separator
  15. # is defined by "path_separator" below.
  16. prepend_sys_path = .
  17. # timezone to use when rendering the date within the migration file
  18. # as well as the filename.
  19. # If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
  20. # Any required deps can installed by adding `alembic[tz]` to the pip requirements
  21. # string value is passed to ZoneInfo()
  22. # leave blank for localtime
  23. # timezone =
  24. # max length of characters to apply to the "slug" field
  25. # truncate_slug_length = 40
  26. # set to 'true' to run the environment during
  27. # the 'revision' command, regardless of autogenerate
  28. # revision_environment = false
  29. # set to 'true' to allow .pyc and .pyo files without
  30. # a source .py file to be detected as revisions in the
  31. # versions/ directory
  32. # sourceless = false
  33. # version location specification; This defaults
  34. # to <script_location>/versions. When using multiple version
  35. # directories, initial revisions must be specified with --version-path.
  36. # The path separator used here should be the separator specified by "path_separator"
  37. # below.
  38. # version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
  39. # path_separator; This indicates what character is used to split lists of file
  40. # paths, including version_locations and prepend_sys_path within configparser
  41. # files such as alembic.ini.
  42. # The default rendered in new alembic.ini files is "os", which uses os.pathsep
  43. # to provide os-dependent path splitting.
  44. #
  45. # Note that in order to support legacy alembic.ini files, this default does NOT
  46. # take place if path_separator is not present in alembic.ini. If this
  47. # option is omitted entirely, fallback logic is as follows:
  48. #
  49. # 1. Parsing of the version_locations option falls back to using the legacy
  50. # "version_path_separator" key, which if absent then falls back to the legacy
  51. # behavior of splitting on spaces and/or commas.
  52. # 2. Parsing of the prepend_sys_path option falls back to the legacy
  53. # behavior of splitting on spaces, commas, or colons.
  54. #
  55. # Valid values for path_separator are:
  56. #
  57. # path_separator = :
  58. # path_separator = ;
  59. # path_separator = space
  60. # path_separator = newline
  61. #
  62. # Use os.pathsep. Default configuration used for new projects.
  63. path_separator = os
  64. # set to 'true' to search source files recursively
  65. # in each "version_locations" directory
  66. # new in Alembic version 1.10
  67. # recursive_version_locations = false
  68. # the output encoding used when revision files
  69. # are written from script.py.mako
  70. # output_encoding = utf-8
  71. # for multiple database configuration, new named sections are added
  72. # which each include a distinct ``sqlalchemy.url`` entry. A custom value
  73. # ``databases`` is added which indicates a listing of the per-database sections.
  74. # The ``databases`` entry as well as the URLs present in the ``[engine1]``
  75. # and ``[engine2]`` sections continue to be consumed by the user-maintained env.py
  76. # script only.
  77. databases = engine1, engine2
  78. [engine1]
  79. sqlalchemy.url = driver://user:pass@localhost/dbname
  80. [engine2]
  81. sqlalchemy.url = driver://user:pass@localhost/dbname2
  82. [post_write_hooks]
  83. # post_write_hooks defines scripts or Python functions that are run
  84. # on newly generated revision scripts. See the documentation for further
  85. # detail and examples
  86. # format using "black" - use the console_scripts runner, against the "black" entrypoint
  87. # hooks = black
  88. # black.type = console_scripts
  89. # black.entrypoint = black
  90. # black.options = -l 79 REVISION_SCRIPT_FILENAME
  91. # lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
  92. # hooks = ruff
  93. # ruff.type = module
  94. # ruff.module = ruff
  95. # ruff.options = check --fix REVISION_SCRIPT_FILENAME
  96. # Alternatively, use the exec runner to execute a binary found on your PATH
  97. # hooks = ruff
  98. # ruff.type = exec
  99. # ruff.executable = ruff
  100. # ruff.options = check --fix REVISION_SCRIPT_FILENAME
  101. # Logging configuration. This is also consumed by the user-maintained
  102. # env.py script only.
  103. [loggers]
  104. keys = root,sqlalchemy,alembic
  105. [handlers]
  106. keys = console
  107. [formatters]
  108. keys = generic
  109. [logger_root]
  110. level = WARNING
  111. handlers = console
  112. qualname =
  113. [logger_sqlalchemy]
  114. level = WARNING
  115. handlers =
  116. qualname = sqlalchemy.engine
  117. [logger_alembic]
  118. level = INFO
  119. handlers =
  120. qualname = alembic
  121. [handler_console]
  122. class = StreamHandler
  123. args = (sys.stderr,)
  124. level = NOTSET
  125. formatter = generic
  126. [formatter_generic]
  127. format = %(levelname)-5.5s [%(name)s] %(message)s
  128. datefmt = %H:%M:%S