[英]How to delete all migration files in Django app
I'm trying to delete all migration files in my Django app using a single command.我正在尝试使用单个命令删除 Django 应用程序中的所有迁移文件。 Here's the structure of my repository:这是我的存储库的结构:
|-- core
| |-- migrations
| |-- __init__.py
| |-- 0001_initial.py
| |-- 0002_add_column1.py
| |-- 0003_add_column1.py
|
|-- users
|-- migrations
|-- __init__.py
|-- 0001_initial.py
|-- 0002_add_column2.py
My goal is to delete all files besides __init__.py
so the repo looks like this:我的目标是删除除__init__.py
之外的所有文件,因此 repo 如下所示:
|-- core
| |-- migrations
| |-- __init__.py
|
|-- users
|-- migrations
|-- __init__.py
I've tried the following command but no luck:我尝试了以下命令,但没有运气:
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
Try this, but change 'ROOT' to your root folder name:试试这个,但将“ROOT”更改为您的根文件夹名称:
find . -path "./ROOT/*/migrations/*.py" -not -name "__init__.py" -delete
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.