-
Notifications
You must be signed in to change notification settings - Fork 0
# PR: プロジェクト「課題・行動・成果」の統合 と 職務経歴書 UI 改善/ # PR: プロジェクトの在籍期間を複数対応(resume_project_periods 子テーブル化) #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73eed31
project form 課題 成果 実績を統合
yusuke0610 4967105
resume ui fix
yusuke0610 e21c902
Merge pull request #276 from yusuke0610/refactor/backend/deadcode
yusuke0610 55068d1
project date list add
yusuke0610 da500c9
Merge pull request #278 from yusuke0610/refactor/backend/deadcode
yusuke0610 f131f2c
coderabbit fix
yusuke0610 6786491
coderabbit fix
yusuke0610 08b5222
Merge pull request #279 from yusuke0610/refactor/backend/deadcode
yusuke0610 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
backend/alembic_migrations/versions/0037_merge_project_caf_into_description.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| """merge resume_projects challenge/action/result into description(課題・行動・成果の統合) | ||
|
|
||
| プロジェクトの「課題」「行動」「成果」は分割する必要がないため、単一の自由記述欄 | ||
| 「詳細」(description) に統合した。これに伴い resume_projects の challenge / action / | ||
| result カラムを削除し、description カラムを新設する。 | ||
|
|
||
| 統合対象の既存本番データは存在しないため、データ移行(3 カラムの連結)は行わない。 | ||
|
|
||
| libSQL (SQLite 互換) は ALTER COLUMN / DROP COLUMN を直接サポートしないため、 | ||
| batch_alter_table(テーブル再作成)でカラムを入れ替える。 | ||
|
|
||
| Revision ID: 0037_merge_project_caf_into_description | ||
| Revises: 0036_rename_github_analysis_to_github_link | ||
| Create Date: 2026-05-27 00:00:00.000000 | ||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy import text | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "0037_merge_project_caf_into_description" | ||
| down_revision: Union[str, None] = "0036_rename_github_analysis_to_github_link" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| conn = op.get_bind() | ||
| result = conn.execute( | ||
| text( | ||
| "SELECT COUNT(*) FROM resume_projects" | ||
| " WHERE challenge != '' OR action != '' OR result != ''" | ||
| ) | ||
| ) | ||
| count = result.scalar() or 0 | ||
| if count > 0: | ||
| raise RuntimeError( | ||
| f"resume_projects に challenge/action/result のデータが {count} 件残っています。" | ||
| "カラム削除前にデータを退避してください。" | ||
| ) | ||
|
|
||
| with op.batch_alter_table("resume_projects") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("description", sa.Text(), nullable=False, server_default=""), | ||
| ) | ||
| batch_op.drop_column("challenge") | ||
| batch_op.drop_column("action") | ||
| batch_op.drop_column("result") | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| with op.batch_alter_table("resume_projects") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("challenge", sa.Text(), nullable=False, server_default=""), | ||
| ) | ||
| batch_op.add_column( | ||
| sa.Column("action", sa.Text(), nullable=False, server_default=""), | ||
| ) | ||
| batch_op.add_column( | ||
| sa.Column("result", sa.Text(), nullable=False, server_default=""), | ||
| ) | ||
| batch_op.drop_column("description") | ||
102 changes: 102 additions & 0 deletions
102
backend/alembic_migrations/versions/0038_add_project_periods_table.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| """resume_project_periods テーブルを追加し、プロジェクトの複数期間に対応する | ||
|
|
||
| ResumeProject の start_date / end_date / is_current を子テーブル | ||
| resume_project_periods に正規化して移す。これにより 1 案件で | ||
| 「2024/01〜2024/12、2025/06〜現在」のような複数の在籍期間を持てるようになる。 | ||
|
|
||
| 既存データは 1 行 1 期間として resume_project_periods に移行する。 | ||
|
|
||
| libSQL (SQLite 互換) は ALTER COLUMN / DROP COLUMN を直接サポートしないため | ||
| batch_alter_table(テーブル再作成)でカラムを削除する。 | ||
|
|
||
| Revision ID: 0038_add_project_periods_table | ||
| Revises: 0037_merge_project_caf_into_description | ||
| Create Date: 2026-05-28 00:00:00.000000 | ||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| revision: str = "0038_add_project_periods_table" | ||
| down_revision: Union[str, None] = "0037_merge_project_caf_into_description" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.create_table( | ||
| "resume_project_periods", | ||
| sa.Column("id", sa.String(36), primary_key=True), | ||
| sa.Column( | ||
| "project_id", | ||
| sa.String(36), | ||
| sa.ForeignKey("resume_projects.id", ondelete="CASCADE"), | ||
| nullable=False, | ||
| index=True, | ||
| ), | ||
| sa.Column("sort_order", sa.Integer(), nullable=False, default=0), | ||
| sa.Column("start_date", sa.Date(), nullable=False), | ||
| sa.Column("end_date", sa.Date(), nullable=True), | ||
| sa.Column("is_current", sa.Boolean(), nullable=False, default=False), | ||
| ) | ||
|
|
||
| # 既存プロジェクトの start_date / end_date / is_current を 1 期間として移行する。 | ||
| conn = op.get_bind() | ||
| rows = conn.execute( | ||
| sa.text("SELECT id, start_date, end_date, is_current FROM resume_projects") | ||
| ).fetchall() | ||
| import uuid as _uuid | ||
| for row in rows: | ||
| conn.execute( | ||
| sa.text( | ||
| "INSERT INTO resume_project_periods " | ||
| "(id, project_id, sort_order, start_date, end_date, is_current) " | ||
| "VALUES (:id, :project_id, 0, :start_date, :end_date, :is_current)" | ||
| ), | ||
| { | ||
| "id": str(_uuid.uuid4()), | ||
| "project_id": row[0], | ||
| "start_date": row[1], | ||
| "end_date": row[2], | ||
| "is_current": row[3], | ||
| }, | ||
| ) | ||
|
|
||
| with op.batch_alter_table("resume_projects") as batch_op: | ||
| batch_op.drop_column("start_date") | ||
| batch_op.drop_column("end_date") | ||
| batch_op.drop_column("is_current") | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| with op.batch_alter_table("resume_projects") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("start_date", sa.Date(), nullable=False, server_default="2000-01-01"), | ||
| ) | ||
| batch_op.add_column( | ||
| sa.Column("end_date", sa.Date(), nullable=True), | ||
| ) | ||
| batch_op.add_column( | ||
| sa.Column("is_current", sa.Boolean(), nullable=False, server_default="0"), | ||
| ) | ||
|
|
||
| # 各プロジェクトの最初の期間(sort_order=0)を resume_projects に書き戻す。 | ||
| conn = op.get_bind() | ||
| rows = conn.execute( | ||
| sa.text( | ||
| "SELECT project_id, start_date, end_date, is_current " | ||
| "FROM resume_project_periods WHERE sort_order = 0" | ||
| ) | ||
| ).fetchall() | ||
| for row in rows: | ||
| conn.execute( | ||
| sa.text( | ||
| "UPDATE resume_projects SET start_date=:sd, end_date=:ed, is_current=:ic " | ||
| "WHERE id=:pid" | ||
| ), | ||
| {"sd": row[1], "ed": row[2], "ic": row[3], "pid": row[0]}, | ||
| ) | ||
|
|
||
| op.drop_table("resume_project_periods") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.