Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7abb977
removed postgres_password from alembic.ini, read it from env var instead
Apr 12, 2019
c23eb50
:twisted_rightwards_arrows: Merge remote
tiangolo Apr 20, 2019
14fe548
:recycle: use f-strings for PostgreSQL URL
tiangolo Apr 20, 2019
059046b
Merge pull request #1 from tiangolo/master
ebreton Apr 27, 2019
900a278
Merge pull request #2 from tiangolo/master
ebreton May 3, 2019
d18d065
Add CrudBase along with SubItem for the showcase
May 3, 2019
c0123bb
Merge pull request #3 from tiangolo/master
ebreton Jun 18, 2019
8033e6a
Add subitem
Sep 5, 2019
7b2ceb9
Merge pull request #4 from tiangolo/master
ebreton Sep 9, 2019
5e93adc
merged master in
Sep 9, 2019
c10da2f
Add orm_mode
Sep 9, 2019
5efdecc
Follow comments on PR
Sep 9, 2019
9db15d8
Renamed models into schemas
Sep 9, 2019
f6a5bf6
Rename db_models into models
Sep 9, 2019
9ce0921
Rename db_models to models
Sep 9, 2019
5f8a300
Forward args passed to test.sh down to test-start.sh
Sep 10, 2019
3acade8
ignore cache, Pilfile.lock and docker-stack.yml
Sep 10, 2019
e464bd3
Fix tests
Sep 10, 2019
8b2f559
Update tests
Sep 19, 2019
fa7adb9
Rename test-backend.sh to test-again.sh, improve doc
Sep 19, 2019
efa4d85
Fix typo and missing argument in CrudBase docstring
Dec 4, 2019
92ad76c
:wrench: Update testing scripts
tiangolo Jan 19, 2020
470661f
:recycle: Refactor CRUD utils to use generics and types
tiangolo Jan 19, 2020
359581f
:rewind: Revert model changes, to have the minimum changes
tiangolo Jan 19, 2020
4d6de8c
:rewind: Revert DB base and changes, separate CRUD from DB models
tiangolo Jan 19, 2020
cc2a769
:rewind: Revert changes in code line order
tiangolo Jan 19, 2020
f4f7d71
:recycle: Refactor Pydantic models, revert changes not related to the…
tiangolo Jan 19, 2020
f7615dd
:sparkles: Use new CRUD utils, revert changes not related to PR
tiangolo Jan 19, 2020
79f0169
:sparkles: Use new CRUD utils in security utils
tiangolo Jan 19, 2020
2a45871
:white_check_mark: Use new CRUD utils in tests
tiangolo Jan 19, 2020
e6f6a86
:arrow_up: Upgrade FastAPI and Uvicorn version
tiangolo Jan 19, 2020
43129b8
:twisted_rightwards_arrows: Merge master
tiangolo Jan 19, 2020
a4b8c89
:recycle: Update files, refactor, simplify
tiangolo Jan 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions {{cookiecutter.project_slug}}/backend/app/alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ script_location = alembic
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = postgresql://postgres:{{cookiecutter.postgres_password}}@db/app


# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
Expand Down
18 changes: 16 additions & 2 deletions {{cookiecutter.project_slug}}/backend/app/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from __future__ import with_statement

import os

from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
Expand Down Expand Up @@ -27,6 +30,15 @@
# ... etc.


def get_url():
return "postgresql://%s:%s@%s/%s" % (
os.getenv("POSTGRES_USER", "postgres"),
os.getenv("POSTGRES_PASSWORD", ""),
os.getenv("POSTGRES_SERVER", "db"),
os.getenv("POSTGRES_DB", "app"),
)


def run_migrations_offline():
"""Run migrations in 'offline' mode.

Expand All @@ -39,7 +51,7 @@ def run_migrations_offline():
script output.

"""
url = config.get_main_option("sqlalchemy.url")
url = get_url()
context.configure(
url=url, target_metadata=target_metadata, literal_binds=True, compare_type=True
)
Expand All @@ -55,8 +67,10 @@ def run_migrations_online():
and associate a connection with the context.

"""
configuration = config.get_section(config.config_ini_section)
configuration['sqlalchemy.url'] = get_url()
connectable = engine_from_config(
config.get_section(config.config_ini_section),
configuration,
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
Expand Down