channel-app 0.0.157a5__py3-none-any.whl → 0.0.157a7__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,89 @@
1
+ import os
2
+ from logging.config import fileConfig
3
+
4
+ from sqlalchemy import engine_from_config
5
+ from sqlalchemy import pool
6
+
7
+ from alembic import context
8
+
9
+ from channel_app.core import settings
10
+ from channel_app.database.models import Base as BaseModel
11
+
12
+ # this is the Alembic Config object, which provides
13
+ # access to the values within the .ini file in use.
14
+ config = context.config
15
+
16
+ # Interpret the config file for Python logging.
17
+ # This line sets up loggers basically.
18
+ if config.config_file_name is not None:
19
+ fileConfig(config.config_file_name)
20
+
21
+ # add your model's MetaData object here
22
+ # for 'autogenerate' support
23
+ # from myapp import mymodel
24
+ # target_metadata = mymodel.Base.metadata
25
+ target_metadata = BaseModel.metadata
26
+
27
+ # other values from the config, defined by the needs of env.py,
28
+ # can be acquired:
29
+ # my_important_option = config.get_main_option("my_important_option")
30
+ # ... etc.
31
+
32
+ DATABASE_URL = f"postgresql+psycopg2://{settings.DB_USER}:{settings.DB_PASSWORD}@{settings.DB_HOST}:{settings.DB_PORT}/{settings.DB_NAME}"
33
+ url = config.set_main_option("sqlalchemy.url", DATABASE_URL)
34
+
35
+
36
+ def run_migrations_offline() -> None:
37
+ """Run migrations in 'offline' mode.
38
+
39
+ This configures the context with just a URL
40
+ and not an Engine, though an Engine is acceptable
41
+ here as well. By skipping the Engine creation
42
+ we don't even need a DBAPI to be available.
43
+
44
+ Calls to context.execute() here emit the given string to the
45
+ script output.
46
+
47
+ """
48
+ url = config.get_main_option("sqlalchemy.url")
49
+
50
+ DATABASE_URL = f"postgresql+psycopg2://{settings.DB_USER}:{settings.DB_PASSWORD}@{settings.DB_HOST}:{settings.DB_PORT}/{settings.DB_NAME}"
51
+ url = config.set_main_option("sqlalchemy.url", DATABASE_URL)
52
+
53
+ context.configure(
54
+ url=url,
55
+ target_metadata=target_metadata,
56
+ literal_binds=True,
57
+ dialect_opts={"paramstyle": "named"},
58
+ )
59
+
60
+ with context.begin_transaction():
61
+ context.run_migrations()
62
+
63
+
64
+ def run_migrations_online() -> None:
65
+ """Run migrations in 'online' mode.
66
+
67
+ In this scenario we need to create an Engine
68
+ and associate a connection with the context.
69
+
70
+ """
71
+ connectable = engine_from_config(
72
+ config.get_section(config.config_ini_section, {}),
73
+ prefix="sqlalchemy.",
74
+ poolclass=pool.NullPool,
75
+ )
76
+
77
+ with connectable.connect() as connection:
78
+ context.configure(
79
+ connection=connection, target_metadata=target_metadata
80
+ )
81
+
82
+ with context.begin_transaction():
83
+ context.run_migrations()
84
+
85
+
86
+ if context.is_offline_mode():
87
+ run_migrations_offline()
88
+ else:
89
+ run_migrations_online()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel-app
3
- Version: 0.0.157a5
3
+ Version: 0.0.157a7
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -35,6 +35,8 @@ channel_app/core/utilities.py,sha256=3iSU4RHFSsdTWBfUYBK23CRGtAIC-nYIBIJLm0Dlx3o
35
35
  channel_app/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  channel_app/database/models.py,sha256=cdjLcfJe-OYZzk1fl3JL6ght8jryRYLwMF2uV3srM-o,2314
37
37
  channel_app/database/services.py,sha256=VkF38jtV_E3Am7459mN5ofvkF1N06gnTWbRdmMzNjYw,354
38
+ channel_app/database/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ channel_app/database/migrations/env.py,sha256=f-AgY2RNfp4nzARjDwBVJE0Yn2L6SSmtx9smvqInPqk,2639
38
40
  channel_app/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
41
  channel_app/logs/encoders.py,sha256=6CVgtkV7DrjxGpNXCJgT9bn9B2Ep0lHgtm-0ES7A57I,703
40
42
  channel_app/logs/enums.py,sha256=If6ZjwRTerbJypYI8WjdsleHR7FjlV-TP2nBppFVEc4,214
@@ -65,7 +67,7 @@ channel_app/omnitron/commands/tests/test_product_images.py,sha256=y6tmiJ00kd2GTq
65
67
  channel_app/omnitron/commands/tests/test_product_prices.py,sha256=5HPX9PmjGw6gk3oNrwtWLqdrOkfeNx1mYP-pYwOesZU,3496
66
68
  channel_app/omnitron/commands/tests/test_product_stocks.py,sha256=q4RGlrCNUUJyN5CBL1fzrvdd4Q3xt816mbMRQT0XEd0,3496
67
69
  channel_app/omnitron/commands/tests/test_products.py,sha256=uj5KLaubY3XNu0hidOH-u-Djfboe81Hj7-lP--01Le0,103494
68
- channel_app-0.0.157a5.dist-info/METADATA,sha256=E4LpnOPC9lBidMzzTPU7U-nIKoVUgrW_iiE6S_vrnxg,311
69
- channel_app-0.0.157a5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
70
- channel_app-0.0.157a5.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
71
- channel_app-0.0.157a5.dist-info/RECORD,,
70
+ channel_app-0.0.157a7.dist-info/METADATA,sha256=RtxxBX0M1iET-I3yhU4mqBHu5Wu4wVRtHeA6txOTZ5M,311
71
+ channel_app-0.0.157a7.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
72
+ channel_app-0.0.157a7.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
73
+ channel_app-0.0.157a7.dist-info/RECORD,,