@palettelab/cli 0.3.19 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-fallback/package.json +1 -1
- package/template-fallback/templates/dashboard/package.json +1 -1
- package/template-fallback/templates/database/backend/migrations/env.py +3 -35
- package/template-fallback/templates/database/package.json +1 -1
- package/template-fallback/templates/external-service/package.json +1 -1
- package/template-fallback/templates/frontend-only/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
"""Alembic environment for
|
|
1
|
+
"""Alembic environment for Palette plugin migrations."""
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from palette_sdk.db.alembic_env import run_migrations
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
from sqlalchemy import engine_from_config, pool
|
|
7
|
-
|
|
8
|
-
from models import Note # noqa: F401 - registers model metadata
|
|
9
|
-
from palette_sdk.db import PluginBase
|
|
10
|
-
|
|
11
|
-
config = context.config
|
|
12
|
-
target_metadata = PluginBase.metadata
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def run_migrations_offline() -> None:
|
|
16
|
-
url = config.get_main_option("sqlalchemy.url")
|
|
17
|
-
context.configure(url=url, target_metadata=target_metadata, literal_binds=True)
|
|
18
|
-
with context.begin_transaction():
|
|
19
|
-
context.run_migrations()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def run_migrations_online() -> None:
|
|
23
|
-
connectable = engine_from_config(
|
|
24
|
-
config.get_section(config.config_ini_section, {}),
|
|
25
|
-
prefix="sqlalchemy.",
|
|
26
|
-
poolclass=pool.NullPool,
|
|
27
|
-
)
|
|
28
|
-
with connectable.connect() as connection:
|
|
29
|
-
context.configure(connection=connection, target_metadata=target_metadata)
|
|
30
|
-
with context.begin_transaction():
|
|
31
|
-
context.run_migrations()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if context.is_offline_mode():
|
|
35
|
-
run_migrations_offline()
|
|
36
|
-
else:
|
|
37
|
-
run_migrations_online()
|
|
5
|
+
run_migrations()
|