Skip to content
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

mscolab dbase migration script missing (documentation) #1742

Closed
ReimarBauer opened this issue Apr 22, 2023 · 2 comments · Fixed by #1746
Closed

mscolab dbase migration script missing (documentation) #1742

ReimarBauer opened this issue Apr 22, 2023 · 2 comments · Fixed by #1746
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@ReimarBauer
Copy link
Member

ReimarBauer commented Apr 22, 2023

Older versions than MSS 8.0.0 don't have a difinition in the operations table of the "active" state.

We need to provide a migration script, or documentation how to update existing databases.

msui 8.0.0 can read older versions of the mscolab server and also new created databases on 8.0.0. We need only the step for updating an existing one.

We should introduce a section migrations and collect there changes for the different parts of open-mss.

@ReimarBauer ReimarBauer added the bug Something isn't working label Apr 22, 2023
@ReimarBauer ReimarBauer added this to the 8.0.1 milestone Apr 22, 2023
@ReimarBauer ReimarBauer added the documentation Improvements or additions to documentation label Apr 22, 2023
@ReimarBauer
Copy link
Member Author

ReimarBauer commented Apr 22, 2023

see https://flask-migrate.readthedocs.io/en/latest/

mamba activate instance
cd ~/INSTANCE/config
export PYTHONPATH=`pwd`


cd ~/INSTANCE/wsgi



flask --app mscolab.py db init
flask --app mscolab.py db migrate -m "To version 8.0.0"
flask --app mscolab.py db upgrade

The output looks like

~/INSTANCE/wsgi$ flask --app mscolab.py db upgrade
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> b70961f58f94, To version 8.0.0

@ReimarBauer ReimarBauer changed the title mscolab dbase migration script missing mscolab dbase migration script missing (documentation) Apr 22, 2023
@ReimarBauer
Copy link
Member Author

ReimarBauer commented Apr 22, 2023

the created migration script contents of b70961f58f94_.py

""To version 8.0.0

Revision ID: b70961f58f94
Revises: 
Create Date: 2023-04-22 11:45:59.483834

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b70961f58f94'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('operations', schema=None) as batch_op:
        batch_op.add_column(sa.Column('active', sa.Boolean(), nullable=True))
        batch_op.add_column(sa.Column('last_used', sa.DateTime(), nullable=True)
)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('operations', schema=None) as batch_op:
        batch_op.drop_column('last_used')
        batch_op.drop_column('active')

    # ### end Alembic commands ###

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant