diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index e3a89a22..d1dfdf4f 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -9,13 +9,16 @@ jobs: runs-on: ubuntu-latest services: mysql: - image: mysql + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password ports: - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis ports: - - 6379 + - 6379:6379 strategy: matrix: @@ -42,7 +45,7 @@ jobs: env: AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - TESTING_DATABASE_URL: mysql+pymysql://root@mysql/ctfd + TESTING_DATABASE_URL: mysql+pymysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/ctfd - name: Codecov uses: codecov/codecov-action@v1.0.11 diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 80a3849d..faed71a9 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -15,6 +15,7 @@ jobs: env: POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_DB: ctfd + POSTGRES_PASSWORD: password # Set health checks to wait until postgres has started options: >- --health-cmd pg_isready @@ -51,7 +52,7 @@ jobs: env: AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - TESTING_DATABASE_URL: 'postgres://postgres@postgres/ctfd' + TESTING_DATABASE_URL: postgres://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/ctfd - name: Codecov uses: codecov/codecov-action@v1.0.11 diff --git a/migrations/versions/0366ba6575ca_add_table_for_comments.py b/migrations/versions/0366ba6575ca_add_table_for_comments.py new file mode 100644 index 00000000..e7a696b1 --- /dev/null +++ b/migrations/versions/0366ba6575ca_add_table_for_comments.py @@ -0,0 +1,47 @@ +"""Add table for comments + +Revision ID: 0366ba6575ca +Revises: 1093835a1051 +Create Date: 2020-08-14 00:46:54.161120 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "0366ba6575ca" +down_revision = "1093835a1051" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + "comments", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("type", sa.String(length=80), nullable=True), + sa.Column("content", sa.Text(), nullable=True), + sa.Column("date", sa.DateTime(), nullable=True), + sa.Column("author_id", sa.Integer(), nullable=True), + sa.Column("challenge_id", sa.Integer(), nullable=True), + sa.Column("user_id", sa.Integer(), nullable=True), + sa.Column("team_id", sa.Integer(), nullable=True), + sa.Column("page_id", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(["author_id"], ["users.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint( + ["challenge_id"], ["challenges.id"], ondelete="CASCADE" + ), + sa.ForeignKeyConstraint(["page_id"], ["pages.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["team_id"], ["teams.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table("comments") + # ### end Alembic commands ###