From aae04b99c33ff021c8d37c208ffe9ed5a0ac1912 Mon Sep 17 00:00:00 2001 From: tchawou-daniel Date: Mon, 18 Jan 2021 00:27:44 +0100 Subject: [PATCH] :wrench: update testbackend.sh file --- migrations/versions/bfac1736655a_.py | 101 +++++++++++++++++++++++++++ testbackend.sh | 10 +-- 2 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 migrations/versions/bfac1736655a_.py diff --git a/migrations/versions/bfac1736655a_.py b/migrations/versions/bfac1736655a_.py new file mode 100644 index 0000000..0681b98 --- /dev/null +++ b/migrations/versions/bfac1736655a_.py @@ -0,0 +1,101 @@ +"""empty message + +Revision ID: bfac1736655a +Revises: 7d3571718539 +Create Date: 2021-01-18 00:26:09.150904 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bfac1736655a' +down_revision = '7d3571718539' +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 ### diff --git a/testbackend.sh b/testbackend.sh index a895b07..5febb34 100755 --- a/testbackend.sh +++ b/testbackend.sh @@ -1,5 +1,5 @@ -#HTTPCODE=$(echo `curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` | tr -d ' ') -#if [ "$HTTPCODE" -ne 200 ];then -# echo "heroku app not responding, failing deploy" -# exit 1 -#fi \ No newline at end of file +HTTPCODE=$(echo `curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` | tr -d ' ') +if [ "$HTTPCODE" -ne 200 ];then + echo "heroku app not responding, failing deploy" + exit 1 +fi \ No newline at end of file