u/0_emordnilap_a_ton

▲ 2 r/flask

How do I downgrade with flask migrate?

Situation 1

If I go

flask db migrate -m "my changes"

but have not run flask db upgrade and I want to downgrade flask migrate just delete the migration file

For example

Here is an example where the file is located.

migrations/

└── versions/

└── a1b2c3d4_my_changes.py

rm migrations/versions/a1b2c3d4_my_changes.py or delete the file manually

Situation 2

Also note

do not delete the migration file before running flask db downgrade if that migration has already been applied with flask db upgrade.

If you already ran flask db upgrade you go

flask db downgrade

This will make migrate downgrade.

The previous command is = to flask db downgrade -1.

if I want to further downgrade I go

flask db downgrade a1b2c3d4

Here is an example where the file is located.

migrations/

└── versions/

└── rgegrgrg_original_migration.py

└── a1b2c3d4_my_changes.py

Or I could go

flask db downgrade -2

to downgrade 2 times.

Also to find the correct migration I should go

flask db history

When I try situation 1 then situation 2 I get the error

INFO [alembic.runtime.migration] Context impl SQLiteImpl.

INFO [alembic.runtime.migration] Will assume non-transactional DDL.

ERROR [flask_migrate] Error: Target database is not up to date.

How do I fix this?

Also if I made any mistakes in the processes above can someone help? I typed how to do this into ai because I could not find any resources by googling that are recent so I assume the ai made a mistake.

reddit.com
u/0_emordnilap_a_ton — 11 days ago

How much can I sell this PC for it is overclocked but in good shape and a little older. Also I plan on deleting the information before selling it.

Windows 10 Enterprise or pro I have to double check.

Intel(R) Core(TM) i7-5775C CPU @ 3.30, 3301 Mhr, 4 Core(s) 8 Logical Processor(1)

NVIDIA GeForce GTX 1070

Total Physical Memory

15.9 GB

Available Physical Memory

12.1 GB

Total Virtual Memory

22.9 GB

Available Virtual Memory

18.5 GB

Page File Space

7.00 GB

Visible drives:

  • Storage (A:)
    • Approximately 775 GB free of 931 GB
  • Local Disk (C:)
    • Approximately 19.0 GB free of 222 GB

baseboard product H97 Gaming 3 (MS-7918)

Also am I missing any info? Also can you state what info I am missing?

u/0_emordnilap_a_ton — 2 months ago