Comments (5)
Ah, I see - sorry for the confusion.
We have the ability to run all migrations - this should work:
piccolo migrations forwards all
I just checked and it's not in the docs - we should mention it here.
There's no option currently to make migrations for all apps. We do what you suggest and have something like:
piccolo migrations new all --auto
from piccolo.
@hoosnick Yeah, you're right - we just have to loop through all the apps.
I've opened a draft PR. It needs a few more tests, but hopefully that does the trick.
from piccolo.
This is the Piccolo equivalent:
piccolo migrations new my_app --auto
As mentioned in the discussion, we should reorder the docs, so this appears nearer the top of the page, as we mention manual migrations first, which is a less common use case.
from piccolo.
@dantownsend Yes I know this command, if I have a project with 7-8 apps to create automatic migration files for all apps at one? We need such a command, which itself creates migration files in the directories related to the changes in the tables in each app.
Here's how I see it:
piccolo migrations new all
Creating migrations for 'myapp-1':
Created tables 2
Dropped tables 0
Renamed tables 0
Created table columns 5
Dropped columns 0
Columns added to existing tables 0
Renamed columns 0
Altered columns 0
Creating migrations for 'myapp-2':
Created tables 2
Dropped tables 0
Renamed tables 0
Created table columns 5
Dropped columns 0
Columns added to existing tables 0
Renamed columns 0
Altered columns 0
Creating migrations for 'myapp-3':
Created tables 2
Dropped tables 0
Renamed tables 0
Created table columns 5
Dropped columns 0
Columns added to existing tables 0
Renamed columns 0
Altered columns 0
piccolo migrations forwards all
SESSION_AUTH
----------------------------------------------------------------
👍 1 migration already complete
🏁 No migrations need to be run
USER
----------------------------------------------------------------
👍 3 migrations already complete
🏁 No migrations need to be run
PICCOLO_ADMIN
----------------------------------------------------------------
👍 0 migrations already complete
🏁 No migrations need to be run
myapp-1
----------------------------------------------------------------
👍 8 migrations already complete
⏩ 1 migration not yet run
🚀 Running 1 migration:
- 2023-07-13T14:37:01:492084 [forwards]... running 2023-07-13T14:37:01:492084
ok! ✔️
myapp-2
----------------------------------------------------------------
👍 2 migrations already complete
⏩ 1 migration not yet run
🚀 Running 1 migration:
- 2023-07-13T14:37:01:492084 [forwards]... running 2023-07-13T14:37:01:492084
ok! ✔️
myapp-3
----------------------------------------------------------------
👍 1 migration already complete
⏩ 1 migration not yet run
🚀 Running 1 migration:
- 2023-07-13T14:37:01:492084 [forwards]... running 2023-07-13T14:37:01:492084
ok! ✔️
from piccolo.
When do you plan to add it?
I think if the AppConfig list of apps is returned in the method below, it's enough to go through the for loop in the new command function in the migrations app.
Lines 460 to 469 in 97292cc
piccolo/piccolo/apps/migrations/commands/new.py
Lines 210 to 249 in 97292cc
from piccolo.
Related Issues (20)
- [Enhancement] Exclude `graphlib` from test coverage HOT 1
- Litestar asgi template currently does not work properly
- `Ruff` as a linter for Piccolo HOT 3
- Tweak how `ModelBuilder` creates JSON values
- auto migrations fails when table in schema HOT 3
- Intermittent TypeError in get_sql_value: isinstance() arg 2 must be a type, a tuple of types, or a union HOT 2
- How to use join? HOT 2
- Implement support for Pydantic v2 HOT 2
- Allow user-defined alternatives to piccolo_app and piccolo_conf files HOT 1
- instance.delete() not work as expected HOT 2
- Properly fix `slotscheck` for Python 3.12
- Type of "create_pydantic_model" is partially unknown (Python 3.11) HOT 3
- Column definition not parsed in class Table HOT 5
- Is it possible to use multiple schemas with SQLiteEngine? HOT 2
- Add columns with `secret=True` parameter to `Table._meta.secret_columns` HOT 1
- `TimestampNow` generates inconsistant values. HOT 4
- Allow SQLite auto migrations
- support in the future for surrealdb? HOT 3
- Pessimistic locking: select for update HOT 2
- Foreign keys with BigSerial not working well HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piccolo.