Skip to content

Commit f7dacf7

Browse files
authored
Group db migrations (#3583)
1 parent 3aae583 commit f7dacf7

File tree

96 files changed

+5
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5
-4
lines changed

src/dstack/_internal/server/alembic.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ script_location = migrations
88
# Uncomment the line below if you want the files to be prepended with date and time
99
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
1010
# for all available tokens
11-
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
11+
file_template = %%(year)d/%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d_%%(rev)s_%%(slug)s
1212

1313
# sys.path path, will be prepended to sys.path if present.
1414
# defaults to the current working directory.
@@ -20,7 +20,7 @@ prepend_sys_path = .
2020
# installed by adding `alembic[tz]` to the pip requirements
2121
# string value is passed to dateutil.tz.gettz()
2222
# leave blank for localtime
23-
# timezone =
23+
timezone = utc
2424

2525
# max length of characters to apply to the
2626
# "slug" field
@@ -50,7 +50,7 @@ path_separator = os
5050
# set to 'true' to search source files recursively
5151
# in each "version_locations" directory
5252
# new in Alembic version 1.10
53-
# recursive_version_locations = false
53+
recursive_version_locations = true
5454

5555
# the output encoding used when revision files
5656
# are written from script.py.mako

src/dstack/_internal/server/db.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,6 @@ async def sqlite_commit(session: AsyncSession):
125125
def _run_alembic_upgrade(connection):
126126
alembic_cfg = config.Config()
127127
alembic_cfg.set_main_option("script_location", settings.ALEMBIC_MIGRATIONS_LOCATION)
128+
alembic_cfg.set_main_option("recursive_version_locations", "true")
128129
alembic_cfg.attributes["connection"] = connection
129130
command.upgrade(alembic_cfg, "head")

src/dstack/_internal/server/migrations/script.py.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Create Date: ${create_date}
66

77
"""
88

9-
from alembic import op
109
import sqlalchemy as sa
1110
import sqlalchemy_utils
11+
from alembic import op
1212

1313
import dstack._internal.server.models
1414
${imports if imports else ""}

src/dstack/_internal/server/migrations/versions/a060e2440936_.py renamed to src/dstack/_internal/server/migrations/versions/2023/09_20_1634_a060e2440936_.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/bfba43f6def2_.py renamed to src/dstack/_internal/server/migrations/versions/2023/09_22_1052_bfba43f6def2_.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/252d3743b641_.py renamed to src/dstack/_internal/server/migrations/versions/2023/09_25_1609_252d3743b641_.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/fe72c4de8376_add_gateways.py renamed to src/dstack/_internal/server/migrations/versions/2023/09_27_1742_fe72c4de8376_add_gateways.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/d0bb68e48b9f_add_project_owners_and_quotas.py renamed to src/dstack/_internal/server/migrations/versions/2023/11_01_1019_d0bb68e48b9f_add_project_owners_and_quotas.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/112753bc17dd_remove_nullable_fields.py renamed to src/dstack/_internal/server/migrations/versions/2023/11_01_1135_112753bc17dd_remove_nullable_fields.py

File renamed without changes.

src/dstack/_internal/server/migrations/versions/14f2cb002fc2_add_jobmodel_removed_flag.py renamed to src/dstack/_internal/server/migrations/versions/2023/11_03_1646_14f2cb002fc2_add_jobmodel_removed_flag.py

File renamed without changes.

0 commit comments

Comments
 (0)