-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,258 changed files
with
34,526 additions
and
36,989 deletions.
There are no files selected for viewing
This file contains 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 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
2 changes: 1 addition & 1 deletion
2
.github/workflows/license_header.yml → .github/workflows/license-header.yml
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: check license headers | ||
name: license-header | ||
on: | ||
push: | ||
branches: | ||
|
This file contains 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 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,13 @@ | ||
name: pr-title | ||
on: | ||
pull_request: | ||
types: ['opened', 'edited', 'reopened', 'synchronize'] | ||
|
||
jobs: | ||
pr-title-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: npm install @commitlint/[email protected] | ||
- uses: JulienKode/[email protected] |
This file contains 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 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
58 changes: 58 additions & 0 deletions
58
alembic/versions/00a9ceb38842_add_study_version_to_commands.py
This file contains 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,58 @@ | ||
"""add_study_version_to_commands | ||
Revision ID: 00a9ceb38842 | ||
Revises: b33e1f57a60c | ||
Create Date: 2024-10-28 10:30:15.877468 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.sql import table, column | ||
from sqlalchemy.orm import Session | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '00a9ceb38842' | ||
down_revision = 'b33e1f57a60c' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Add new column with empty data | ||
with op.batch_alter_table("commandblock", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('study_version', sa.String(length=36), server_default="fake_version", nullable=False)) | ||
|
||
# Create db connection | ||
bind = op.get_bind() | ||
session = Session(bind=bind) | ||
|
||
# Reference tables | ||
commandblock_table = table('commandblock', column('id'), column('study_id')) | ||
study_table = table('study', column('id'), column('version')) | ||
|
||
# Gathers commands by study_id | ||
commands = session.query(commandblock_table).all() | ||
mapping = {} | ||
for cmd in commands: | ||
cmd_id = cmd[0] | ||
study_id = cmd[1] | ||
mapping.setdefault(study_id, []).append(cmd_id) | ||
|
||
# Gets studies versions | ||
study_info = session.query(study_table).filter(study_table.c.id.in_(mapping)).all() | ||
|
||
# Clean orphan commands | ||
study_ids = {study_id for study_id, _ in study_info} | ||
ids_to_remove = {cmd_id for study_id, cmd_ids in mapping.items() if study_id not in study_ids for cmd_id in cmd_ids} | ||
bind.execute(commandblock_table.delete().where(commandblock_table.c.id.in_(ids_to_remove))) | ||
|
||
# Insert new values | ||
alter_table = table("commandblock", column("id"), column("study_id"), column("study_version")) | ||
scalar_subq = sa.select(study_table.c.version).where(study_table.c.id == alter_table.c.study_id).scalar_subquery() | ||
bind.execute(sa.update(alter_table).values(study_version=scalar_subq)) | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table("commandblock", schema=None) as batch_op: | ||
batch_op.drop_column('study_version') |
36 changes: 36 additions & 0 deletions
36
alembic/versions/bae9c99bc42d_add_user_name_and_updated_at_to_commands.py
This file contains 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,36 @@ | ||
"""add_user_name_and_updated_at_to_commands | ||
Revision ID: bae9c99bc42d | ||
Revises: 00a9ceb38842 | ||
Create Date: 2024-11-29 09:13:04.292874 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'bae9c99bc42d' | ||
down_revision = '00a9ceb38842' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
USER_ID_FKEY = 'commandblock_user_id_fk' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('commandblock', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True)) | ||
batch_op.add_column(sa.Column('updated_at', sa.DateTime(), nullable=True)) | ||
batch_op.create_foreign_key(USER_ID_FKEY, 'identities', ['user_id'], ['id'], ondelete='SET NULL') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('commandblock', schema=None) as batch_op: | ||
batch_op.drop_constraint(USER_ID_FKEY, type_='foreignkey') | ||
batch_op.drop_column('updated_at') | ||
batch_op.drop_column('user_id') | ||
# ### end Alembic commands ### |
This file contains 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 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 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 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 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 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.