alembic icon indicating copy to clipboard operation
alembic copied to clipboard

script_location PATH config is not OS agnostic

Open developer992 opened this issue 1 year ago • 7 comments

Describe the bug This setting is different if you are running on Windows OS or Linux OS

script_location = app/db/migrations

Expected behavior I am developing on Windows machine and i set the value of the setting to "app\db\migrations"

But then I build docker image, deploy and want to run it the server and I have to fix the config file to "app/db/migrations"

I find myself changing this quite frequently, is there a way to define this with mutli OS support in mind?

Thanks

To Reproduce Please try to provide a Minimal, Complete, and Verifiable example, with the migration script and/or the SQLAlchemy tables or models involved. See also Reporting Bugs on the website.

# Insert code here

Error

# Copy error here. Please include the full stack trace.

Versions.

  • OS:
  • Python:
  • Alembic:
  • SQLAlchemy:
  • Database:
  • DBAPI:

Additional context

Have a nice day!

developer992 avatar Feb 26 '24 10:02 developer992

Hi,

Does using / on windows not work?

CaselIT avatar Feb 26 '24 10:02 CaselIT

no it fails with

FAILED: Path doesn't exist: '/app/xara\\db\\migrations'.  Please use the 'init' command to create a new scripts
  folder.
˙˙˙`

developer992 avatar Feb 26 '24 11:02 developer992

that seems an absolute path, is that what you wanted to use?

CaselIT avatar Feb 26 '24 13:02 CaselIT

I have the setting in relative path but this is what running "alembic upgrade head" outputs

developer992 avatar Feb 27 '24 06:02 developer992

I can't reproduce.

I've just tried the following:

> systeminfo | rg 'OS Name'
OS Name:                   Microsoft Windows 11 Pro
> rg script_location .\alembic.ini
5:script_location = foo/bar/baz/migrations
> alembic history
<base> -> baaccf72950c (head), one
> ls .

    Directory: path\to\here

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          27/02/2024    20:48                foo
-a---          27/02/2024    20:49           3647 alembic.ini
-a---          27/02/2024    20:49          24576 db.sqlite

CaselIT avatar Feb 27 '24 19:02 CaselIT

hm ok thta's good news, thanks ...

maybe different powershell version?

> pwsh -v
PowerShell 7.4.1

developer992 avatar Feb 28 '24 05:02 developer992

I don't think it's something that has to do with powershell, since the path is never handled by the shell since it's in the alembic file that's read by python.

Can you create a reproducing case for the error you are seeing?

CaselIT avatar Feb 28 '24 10:02 CaselIT