Browse Source

edit config.yml 📝

dependabot/pip/requirements/sqlalchemy-1.3.0
Gautier couture 6 years ago
parent
commit
4469973d91
  1. 22
      .circleci/config.yml
  2. 4
      migrations/env.py
  3. 101
      migrations/versions/2267f00a4594_.py

22
.circleci/config.yml

@ -8,7 +8,7 @@ jobs:
- restore_cache: - restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }}
- run: - run:
name: Install dependencies in a python venv
name: Install dependencies
command: | command: |
python3 -m venv venv python3 -m venv venv
. venv/bin/activate . venv/bin/activate
@ -35,17 +35,17 @@ jobs:
- restore_cache: - restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }}
- run: - run:
name: Wait for postgres
name: Wait
command: dockerize -wait tcp://localhost:5432 -timeout 1m command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: - run:
name: running test
name: Run tests
command: | command: |
. venv/bin/activate . venv/bin/activate
flask db upgrade flask db upgrade
flask test flask test
build_docker: build_docker:
environment: environment:
IMAGE_NAME: sgttabouret/devops-final-back
IMAGE_NAME: skinkan/TP_FINAL_DEVOPS
docker: docker:
- image: circleci/buildpack-deps:stretch - image: circleci/buildpack-deps:stretch
steps: steps:
@ -59,7 +59,7 @@ jobs:
- ./image.tar - ./image.tar
push_docker: push_docker:
environment: environment:
IMAGE_NAME: sgttabouret/devops-final-back
IMAGE_NAME: skinkan/TP_FINAL_DEVOPS
docker: docker:
- image: circleci/buildpack-deps:stretch - image: circleci/buildpack-deps:stretch
steps: steps:
@ -70,7 +70,7 @@ jobs:
- run: - run:
name: Login and push to DockerHub name: Login and push to DockerHub
command: | command: |
echo "$DOCKERHUB_PASS" | docker login --username skinkan --password-159753
echo "$DOCKERHUB_PASS" | docker login --username skinkan --password-Admin159753
docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM
docker tag $IMAGE_NAME:app $IMAGE_NAME:latest docker tag $IMAGE_NAME:app $IMAGE_NAME:latest
docker push $IMAGE_NAME:$CIRCLE_BUILD_NUM docker push $IMAGE_NAME:$CIRCLE_BUILD_NUM
@ -89,11 +89,11 @@ workflows:
build-test: build-test:
jobs: jobs:
- build - build
# - test:
# context:
# - back_final
# requires:
# - build
- test:
context:
- back_final
requires:
- build
- build_docker: - build_docker:
requires: requires:
# - test # - test

4
migrations/env.py

@ -23,8 +23,8 @@ logger = logging.getLogger('alembic.env')
# target_metadata = mymodel.Base.metadata # target_metadata = mymodel.Base.metadata
from flask import current_app from flask import current_app
config.set_main_option( config.set_main_option(
'sqlalchemy.url', current_app.config.get(
'SQLALCHEMY_DATABASE_URI').replace('%', '%%'))
'sqlalchemy.url',
str(current_app.extensions['migrate'].db.engine.url).replace('%', '%%'))
target_metadata = current_app.extensions['migrate'].db.metadata target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py, # other values from the config, defined by the needs of env.py,

101
migrations/versions/2267f00a4594_.py

@ -1,101 +0,0 @@
"""empty message
Revision ID: 2267f00a4594
Revises:
Create Date: 2020-01-04 15:20:33.461410
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2267f00a4594'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tags',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('tagname', sa.String(length=100), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=80), nullable=False),
sa.Column('email', sa.String(length=100), nullable=False),
sa.Column('password', sa.Binary(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.Column('bio', sa.String(length=300), nullable=True),
sa.Column('image', sa.String(length=120), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('username')
)
op.create_table('userprofile',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('user_id')
)
op.create_table('article',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('slug', sa.Text(), nullable=True),
sa.Column('title', sa.String(length=100), nullable=False),
sa.Column('description', sa.Text(), nullable=False),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=False),
sa.Column('updatedAt', sa.DateTime(), nullable=False),
sa.Column('author_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['author_id'], ['userprofile.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('slug')
)
op.create_table('followers_assoc',
sa.Column('follower', sa.Integer(), nullable=True),
sa.Column('followed_by', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['followed_by'], ['userprofile.user_id'], ),
sa.ForeignKeyConstraint(['follower'], ['userprofile.user_id'], )
)
op.create_table('comment',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=False),
sa.Column('updatedAt', sa.DateTime(), nullable=False),
sa.Column('author_id', sa.Integer(), nullable=False),
sa.Column('article_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['article_id'], ['article.id'], ),
sa.ForeignKeyConstraint(['author_id'], ['userprofile.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('favoritor_assoc',
sa.Column('favoriter', sa.Integer(), nullable=True),
sa.Column('favorited_article', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['favorited_article'], ['article.id'], ),
sa.ForeignKeyConstraint(['favoriter'], ['userprofile.id'], )
)
op.create_table('tag_assoc',
sa.Column('tag', sa.Integer(), nullable=True),
sa.Column('article', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['article'], ['article.id'], ),
sa.ForeignKeyConstraint(['tag'], ['tags.id'], )
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('tag_assoc')
op.drop_table('favoritor_assoc')
op.drop_table('comment')
op.drop_table('followers_assoc')
op.drop_table('article')
op.drop_table('userprofile')
op.drop_table('users')
op.drop_table('tags')
# ### end Alembic commands ###
Loading…
Cancel
Save