Initial commit – TimeMaster Zeiterfassung & HR-Tool
Stand: agent-06 (Audit-Log), agent-05 (Krankmeldung), agent-07 Phase 1 (Personalnummer), Busylight-Pull-Integration, TOTP/2FA, Abwesenheiten, Zeiterfassung, Kiosk-Grundgerüst. Migrations 0001–0023 deployed auf 192.168.1.137 + .164. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""projects table + time_entries FK
|
||||
|
||||
Revision ID: 0013_projects
|
||||
Revises: 0012_caldav_template_and_kuerzel
|
||||
Create Date: 2026-03-28
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
revision = "0013_projects"
|
||||
down_revision = "0012_caldav_template_and_kuerzel"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Projekte-Tabelle
|
||||
op.create_table(
|
||||
"projects",
|
||||
sa.Column("id", UUID(as_uuid=True), primary_key=True),
|
||||
sa.Column("company_id", UUID(as_uuid=True),
|
||||
sa.ForeignKey("companies.id", ondelete="CASCADE"), nullable=False, index=True),
|
||||
sa.Column("name", sa.String(100), nullable=False),
|
||||
sa.Column("description", sa.Text, nullable=True),
|
||||
sa.Column("color", sa.String(7), nullable=False, server_default="#3B82F6"),
|
||||
sa.Column("budget_hours", sa.Numeric(8, 2), nullable=True),
|
||||
sa.Column("is_active", sa.Boolean, nullable=False, server_default="true"),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
)
|
||||
|
||||
# FK von time_entries.project_id → projects.id
|
||||
op.create_foreign_key(
|
||||
"fk_time_entries_project_id",
|
||||
"time_entries", "projects",
|
||||
["project_id"], ["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_constraint("fk_time_entries_project_id", "time_entries", type_="foreignkey")
|
||||
op.drop_table("projects")
|
||||
Reference in New Issue
Block a user