diff --git a/7project/backend/alembic.ini b/7project/backend/alembic.ini index c6931a7..6dca9ab 100644 --- a/7project/backend/alembic.ini +++ b/7project/backend/alembic.ini @@ -11,7 +11,7 @@ script_location = %(here)s/alembic # Uncomment the line below if you want the files to be prepended with date and time # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file # for all available tokens -# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s +file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s # sys.path path, will be prepended to sys.path if present. # defaults to the current working directory. for multiple paths, the path separator diff --git a/7project/backend/alembic/versions/81f275275556_init_migration.py b/7project/backend/alembic/versions/2025_10_09_1456-63e072f09836_add_categories.py similarity index 60% rename from 7project/backend/alembic/versions/81f275275556_init_migration.py rename to 7project/backend/alembic/versions/2025_10_09_1456-63e072f09836_add_categories.py index 097cc09..1ddf813 100644 --- a/7project/backend/alembic/versions/81f275275556_init_migration.py +++ b/7project/backend/alembic/versions/2025_10_09_1456-63e072f09836_add_categories.py @@ -1,8 +1,8 @@ -"""Init migration +"""add categories -Revision ID: 81f275275556 +Revision ID: 63e072f09836 Revises: -Create Date: 2025-09-24 17:39:25.346690 +Create Date: 2025-10-09 14:56:14.653249 """ from typing import Sequence, Union @@ -13,7 +13,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision: str = '81f275275556' +revision: str = '63e072f09836' down_revision: Union[str, Sequence[str], None] = None branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -22,12 +22,6 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### - op.create_table('transaction', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('amount', sa.Float(), nullable=False), - sa.Column('description', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id') - ) op.create_table('user', sa.Column('first_name', sa.String(length=100), nullable=True), sa.Column('last_name', sa.String(length=100), nullable=True), @@ -40,13 +34,38 @@ def upgrade() -> None: sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True) + op.create_table('categories', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('name', sa.String(length=100), nullable=False), + sa.Column('description', sa.String(length=255), nullable=True), + sa.Column('user_id', fastapi_users_db_sqlalchemy.generics.GUID(), nullable=False), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('name') + ) + op.create_table('transaction', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('amount', sa.Float(), nullable=False), + sa.Column('description', sa.String(length=255), nullable=True), + sa.Column('user_id', fastapi_users_db_sqlalchemy.generics.GUID(), nullable=False), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('category_transaction', + sa.Column('id_category', sa.Integer(), nullable=True), + sa.Column('id_transaction', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['id_category'], ['categories.id'], ), + sa.ForeignKeyConstraint(['id_transaction'], ['transaction.id'], ) + ) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('category_transaction') + op.drop_table('transaction') + op.drop_table('categories') op.drop_index(op.f('ix_user_email'), table_name='user') op.drop_table('user') - op.drop_table('transaction') # ### end Alembic commands ### diff --git a/7project/backend/alembic/versions/a60134ef6c4c_add_categories.py b/7project/backend/alembic/versions/a60134ef6c4c_add_categories.py deleted file mode 100644 index 7c1e599..0000000 --- a/7project/backend/alembic/versions/a60134ef6c4c_add_categories.py +++ /dev/null @@ -1,48 +0,0 @@ -"""add categories - -Revision ID: a60134ef6c4c -Revises: c5e9d6c59812 -Create Date: 2025-10-09 14:29:31.170347 - -""" -from typing import Sequence, Union - -import fastapi_users_db_sqlalchemy -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = 'a60134ef6c4c' -down_revision: Union[str, Sequence[str], None] = 'c5e9d6c59812' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('categories', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('name', sa.String(length=100), nullable=False), - sa.Column('description', sa.String(length=255), nullable=True), - sa.Column('user_id', fastapi_users_db_sqlalchemy.generics.GUID(), nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name') - ) - op.create_table('category_transaction', - sa.Column('id_category', sa.Integer(), nullable=True), - sa.Column('id_transaction', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['id_category'], ['categories.id'], ), - sa.ForeignKeyConstraint(['id_transaction'], ['transaction.id'], ) - ) - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('category_transaction') - op.drop_table('categories') - # ### end Alembic commands ### diff --git a/7project/backend/alembic/versions/c5e9d6c59812_user_transaction_relationship.py b/7project/backend/alembic/versions/c5e9d6c59812_user_transaction_relationship.py deleted file mode 100644 index b88a489..0000000 --- a/7project/backend/alembic/versions/c5e9d6c59812_user_transaction_relationship.py +++ /dev/null @@ -1,41 +0,0 @@ -"""User transaction relationship - -Revision ID: c5e9d6c59812 -Revises: 81f275275556 -Create Date: 2025-10-09 14:17:19.983889 - -""" -from typing import Sequence, Union - -import fastapi_users_db_sqlalchemy -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = 'c5e9d6c59812' -down_revision: Union[str, Sequence[str], None] = '81f275275556' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('transaction', 'user_id', - existing_type=sa.UUID(), - type_=fastapi_users_db_sqlalchemy.generics.GUID(), - existing_nullable=False) - op.create_foreign_key(None, 'transaction', 'user', ['user_id'], ['id']) - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint(None, 'transaction', type_='foreignkey') - op.alter_column('transaction', 'user_id', - existing_type=fastapi_users_db_sqlalchemy.generics.GUID(), - type_=sa.UUID(), - existing_nullable=False) - # ### end Alembic commands ### diff --git a/7project/tofu/modules/maxscale/charts/maxscale-helm/Chart.yaml b/7project/tofu/modules/maxscale/charts/maxscale-helm/Chart.yaml index 15afe88..c78c909 100644 --- a/7project/tofu/modules/maxscale/charts/maxscale-helm/Chart.yaml +++ b/7project/tofu/modules/maxscale/charts/maxscale-helm/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 name: maxscale-helm -version: 1.0.7 +version: 1.0.8 description: Helm chart for MaxScale related Kubernetes manifests diff --git a/7project/tofu/modules/maxscale/charts/maxscale-helm/templates/phpmyadmin-deployment.yaml b/7project/tofu/modules/maxscale/charts/maxscale-helm/templates/phpmyadmin-deployment.yaml index 4a0156c..1ee7b38 100644 --- a/7project/tofu/modules/maxscale/charts/maxscale-helm/templates/phpmyadmin-deployment.yaml +++ b/7project/tofu/modules/maxscale/charts/maxscale-helm/templates/phpmyadmin-deployment.yaml @@ -28,7 +28,7 @@ spec: - name: DATABASE_ENABLE_SSL value: "yes" - name: DATABASE_HOST - value: "mariadb-repl" + value: "mariadb-repl-maxscale-internal" - name: DATABASE_PORT_NUMBER value: "3306" - name: PHPMYADMIN_ALLOW_NO_PASSWORD diff --git a/7project/tofu/modules/maxscale/main.tf b/7project/tofu/modules/maxscale/main.tf index 2b44909..af5a401 100644 --- a/7project/tofu/modules/maxscale/main.tf +++ b/7project/tofu/modules/maxscale/main.tf @@ -58,7 +58,7 @@ resource "helm_release" "mariadb-operator" { resource "helm_release" "maxscale_helm" { name = "maxscale-helm" chart = "${path.module}/charts/maxscale-helm" - version = "1.0.7" + version = "1.0.8" depends_on = [ helm_release.mariadb-operator-crds, kubectl_manifest.secrets ] timeout = 3600