Fix Outlook foreign key column sizes
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
7965925fad
commit
afb29d9828
2 changed files with 110 additions and 3 deletions
|
|
@ -95,7 +95,7 @@ class OutlookAttachment(db.Model):
|
||||||
__tablename__ = "outlook_attachments"
|
__tablename__ = "outlook_attachments"
|
||||||
|
|
||||||
id = db.Column(db.String(100), primary_key=True) # Attachment ID from Microsoft
|
id = db.Column(db.String(100), primary_key=True) # Attachment ID from Microsoft
|
||||||
mail_id = db.Column(db.String(100), db.ForeignKey("outlook_mails.id"), nullable=False)
|
mail_id = db.Column(db.String(500), db.ForeignKey("outlook_mails.id"), nullable=False)
|
||||||
name = db.Column(db.String(500), nullable=False)
|
name = db.Column(db.String(500), nullable=False)
|
||||||
content_type = db.Column(db.String(100), nullable=True)
|
content_type = db.Column(db.String(100), nullable=True)
|
||||||
size = db.Column(db.Integer, default=0)
|
size = db.Column(db.Integer, default=0)
|
||||||
|
|
@ -112,7 +112,7 @@ class OutlookMailInterpretation(db.Model):
|
||||||
__tablename__ = "outlook_mail_interpretations"
|
__tablename__ = "outlook_mail_interpretations"
|
||||||
|
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
mail_id = db.Column(db.String(100), db.ForeignKey("outlook_mails.id"), nullable=False)
|
mail_id = db.Column(db.String(500), db.ForeignKey("outlook_mails.id"), nullable=False)
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False)
|
user_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False)
|
||||||
|
|
||||||
# Analyse brute (texte de l'IA)
|
# Analyse brute (texte de l'IA)
|
||||||
|
|
@ -316,4 +316,4 @@ class GmaoContext(db.Model):
|
||||||
|
|
||||||
|
|
||||||
# Note: Les routes Outlook sont dans app_new/outlook/routes.py
|
# Note: Les routes Outlook sont dans app_new/outlook/routes.py
|
||||||
# Les templates sont dans app_new/outlook/templates/
|
# Les templates sont dans app_new/outlook/templates/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
"""Match Outlook child foreign keys to the parent mail identifier.
|
||||||
|
|
||||||
|
Revision ID: d9e3f4a5b6c7
|
||||||
|
Revises: c8d2e3f4a5b6
|
||||||
|
Create Date: 2026-08-14
|
||||||
|
"""
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
revision = "d9e3f4a5b6c7"
|
||||||
|
down_revision = "c8d2e3f4a5b6"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.drop_constraint(
|
||||||
|
"outlook_attachments_ibfk_1", "outlook_attachments", type_="foreignkey"
|
||||||
|
)
|
||||||
|
op.drop_constraint(
|
||||||
|
"outlook_mail_interpretations_ibfk_1",
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
type_="foreignkey",
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_mails",
|
||||||
|
"id",
|
||||||
|
existing_type=sa.String(length=100),
|
||||||
|
type_=sa.String(length=500),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_attachments",
|
||||||
|
"mail_id",
|
||||||
|
existing_type=sa.String(length=100),
|
||||||
|
type_=sa.String(length=500),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
"mail_id",
|
||||||
|
existing_type=sa.String(length=100),
|
||||||
|
type_=sa.String(length=500),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.create_foreign_key(
|
||||||
|
"outlook_attachments_ibfk_1",
|
||||||
|
"outlook_attachments",
|
||||||
|
"outlook_mails",
|
||||||
|
["mail_id"],
|
||||||
|
["id"],
|
||||||
|
)
|
||||||
|
op.create_foreign_key(
|
||||||
|
"outlook_mail_interpretations_ibfk_1",
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
"outlook_mails",
|
||||||
|
["mail_id"],
|
||||||
|
["id"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_constraint(
|
||||||
|
"outlook_mail_interpretations_ibfk_1",
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
type_="foreignkey",
|
||||||
|
)
|
||||||
|
op.drop_constraint(
|
||||||
|
"outlook_attachments_ibfk_1", "outlook_attachments", type_="foreignkey"
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
"mail_id",
|
||||||
|
existing_type=sa.String(length=500),
|
||||||
|
type_=sa.String(length=100),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_attachments",
|
||||||
|
"mail_id",
|
||||||
|
existing_type=sa.String(length=500),
|
||||||
|
type_=sa.String(length=100),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
"outlook_mails",
|
||||||
|
"id",
|
||||||
|
existing_type=sa.String(length=500),
|
||||||
|
type_=sa.String(length=100),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
op.create_foreign_key(
|
||||||
|
"outlook_mail_interpretations_ibfk_1",
|
||||||
|
"outlook_mail_interpretations",
|
||||||
|
"outlook_mails",
|
||||||
|
["mail_id"],
|
||||||
|
["id"],
|
||||||
|
)
|
||||||
|
op.create_foreign_key(
|
||||||
|
"outlook_attachments_ibfk_1",
|
||||||
|
"outlook_attachments",
|
||||||
|
"outlook_mails",
|
||||||
|
["mail_id"],
|
||||||
|
["id"],
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue