Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ jobs:

- name: Vérifier et appliquer les migrations si besoin
run: |
echo "🔍 Vérification des changements dans les modèles..."

flask db migrate -m "Migration auto" || true

if git diff --quiet --exit-code -- migrations/versions; then
echo "✅ Aucun changement détecté. Pas de migration à appliquer."
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ jobs:
- name: Exécution de Pylint
run: pylint $(find . -name "*.py" -not -path "./migrations/*") --disable=W

- name: Vérifier et appliquer les migrations si besoin
- name: Vérifier et appliquer les migrations générées par le workflow develop
run: |
echo "🔍 Vérification des changements dans les modèles..."

flask db migrate -m "Migration auto" || true

#pas de migratins dans ce workflow, on upgrade la bdd
if git diff --quiet --exit-code -- migrations/versions; then
echo "✅ Aucun changement détecté. Pas de migration à appliquer."
else
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
*.pyc
50 changes: 50 additions & 0 deletions migrations/versions/6b53a099248e_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""test

Revision ID: 6b53a099248e
Revises:
Create Date: 2025-04-02 19:40:19.927384

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '6b53a099248e'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('sbom')
op.drop_table('project')
with op.batch_alter_table('trivy_reports', schema=None) as batch_op:
batch_op.add_column(sa.Column('sbom_id', sa.Integer(), nullable=False))
batch_op.create_foreign_key(None, 'sboms', ['sbom_id'], ['id'])

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('trivy_reports', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('sbom_id')

op.create_table('project',
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('project_id_seq'::regclass)"), autoincrement=True, nullable=False),
sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
sa.Column('version', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('id', name='project_pkey'),
postgresql_ignore_search_path=False
)
op.create_table('sbom',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('sbom_data', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['project_id'], ['project.id'], name='sbom_project_id_fkey'),
sa.PrimaryKeyConstraint('id', name='sbom_pkey')
)
# ### end Alembic commands ###
Binary file not shown.