Skip to content

Error: FAILED: Directory already exists #571

@aviskarkc10

Description

@aviskarkc10

I am trying to initialize my migration inside a docker image with the command:
alembic init {dir_name}

For this I will have to map the volume in my system as follows:

docker run -it -v $(pwd)/migrations:/app/migrations {docker_image_name} alembic init migrations

But this throws the error FAILED: Directory migrations already exists because we are checking the following condition:

if os.access(directory, os.F_OK):
        raise util.CommandError("Directory %s already exists" % directory)

Because of this, I won't be able to initialize my migrations as without volume mapping there is no way to persist the migrations folder in my system.

Is there any reason why we are doing so?
Maybe we should change this implementation to ask the user if they want to overwrite their current migrations?

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions