Skip to content

Commit 39efe97

Browse files
committed
Fixed migrations fr this time
1 parent b50024e commit 39efe97

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

conditional/models/models.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,41 @@ def __init__(self, fid, seminar_id):
127127
self.fid = fid
128128
self.seminar_id = seminar_id
129129

130-
131130
class MajorProject(db.Model):
132131
__tablename__ = 'major_projects'
133132
id = Column(Integer, primary_key=True)
134133
date = Column(Date, nullable=False)
135134
uid = Column(String(32), nullable=False, index=True)
136135
name = Column(String(64), nullable=False)
137-
description = Column(Text)
136+
tldr = Column(String(128), nullable=True)
137+
timeSpent = Column(Text, nullable=True)
138+
description = Column(Text, nullable=False)
139+
links = Column(Text, nullable=True)
138140
active = Column(Boolean, nullable=False)
139141
status = Column(Enum('Pending', 'Passed', 'Failed',
140142
name="major_project_enum"),
141143
nullable=False)
142144

143-
def __init__(self, uid, name, desc):
145+
def __init__(self, uid, name, tldr, time_spent, description, links):
144146
self.uid = uid
145147
self.date = datetime.now()
146148
self.name = name
147-
self.description = desc
149+
self.tldr = tldr
150+
self.timeSpent = time_spent
151+
self.description = description
152+
self.links = links
148153
self.status = 'Pending'
149154
self.active = True
150155

156+
class MajorProjectSkill(db.Model):
157+
__tablename__ = "major_project_skills"
158+
project_id = Column(Integer, ForeignKey('major_projects.id', ondelete="cascade"), nullable=False, primary_key=True)
159+
skill = Column(Text, nullable=False, primary_key=True)
160+
161+
def __init__(self, project_id, skill):
162+
self.project_id = project_id
163+
self.skill = skill
164+
151165

152166
class HouseMeeting(db.Model):
153167
__tablename__ = 'house_meetings'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""add new fields to major project form
2+
3+
Revision ID: 09603d1cfc38
4+
Revises: f1d08673b870
5+
Create Date: 2026-03-01 10:46:33.652106
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = '09603d1cfc38'
11+
down_revision = 'f1d08673b870'
12+
13+
from alembic import op
14+
import sqlalchemy as sa
15+
16+
17+
def upgrade():
18+
# ### commands auto generated by Alembic - please adjust! ###
19+
op.create_table('major_project_skills',
20+
sa.Column('project_id', sa.Integer(), nullable=False),
21+
sa.Column('skill', sa.Text(), nullable=False),
22+
sa.ForeignKeyConstraint(['project_id'], ['major_projects.id'], ondelete='cascade'),
23+
sa.PrimaryKeyConstraint('project_id', 'skill')
24+
)
25+
op.add_column('major_projects', sa.Column('tldr', sa.String(length=128), nullable=True))
26+
op.add_column('major_projects', sa.Column('timeSpent', sa.Text(), nullable=True))
27+
op.add_column('major_projects', sa.Column('links', sa.Text(), nullable=True))
28+
op.alter_column('major_projects', 'description',
29+
existing_type=sa.TEXT(),
30+
nullable=False)
31+
# ### end Alembic commands ###
32+
33+
34+
def downgrade():
35+
# ### commands auto generated by Alembic - please adjust! ###
36+
op.alter_column('major_projects', 'description',
37+
existing_type=sa.TEXT(),
38+
nullable=True)
39+
op.drop_column('major_projects', 'links')
40+
op.drop_column('major_projects', 'timeSpent')
41+
op.drop_column('major_projects', 'tldr')
42+
op.drop_table('major_project_skills')
43+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)