mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-06-15 21:29:59 +00:00
cleanup
This commit is contained in:
parent
6c76b47f04
commit
18202a9b99
@ -1,8 +0,0 @@
|
|||||||
# app/auth/__init__.py
|
|
||||||
from flask import Blueprint
|
|
||||||
|
|
||||||
# Define the auth blueprint
|
|
||||||
bp = Blueprint('auth', __name__, template_folder='templates')
|
|
||||||
|
|
||||||
# Import routes at the bottom
|
|
||||||
from app.auth import routes
|
|
@ -1,13 +0,0 @@
|
|||||||
# app/auth/forms.py
|
|
||||||
from flask_wtf import FlaskForm
|
|
||||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
|
||||||
from wtforms.validators import DataRequired
|
|
||||||
|
|
||||||
# Moved from control_panel forms
|
|
||||||
class LoginForm(FlaskForm):
|
|
||||||
username = StringField('Username', validators=[DataRequired()])
|
|
||||||
password = PasswordField('Password', validators=[DataRequired()])
|
|
||||||
remember_me = BooleanField('Remember Me')
|
|
||||||
submit = SubmitField('Sign In')
|
|
||||||
|
|
||||||
# Add RegistrationForm, ResetPasswordRequestForm etc. here later
|
|
@ -1,59 +0,0 @@
|
|||||||
# app/auth/routes.py
|
|
||||||
from flask import render_template, flash, redirect, url_for, request
|
|
||||||
from flask_login import current_user, login_user, logout_user # Keep current_user for checking auth status
|
|
||||||
from app import db
|
|
||||||
from app.models import User
|
|
||||||
from app.auth import bp # Import the auth blueprint
|
|
||||||
from .forms import LoginForm # Import LoginForm from within auth blueprint
|
|
||||||
|
|
||||||
@bp.route('/login', methods=['GET', 'POST'])
|
|
||||||
def login():
|
|
||||||
if current_user.is_authenticated:
|
|
||||||
# Redirect authenticated users away from login page
|
|
||||||
# Maybe check role here too? Or just send to core index.
|
|
||||||
if current_user.role == 'admin':
|
|
||||||
return redirect(url_for('control_panel.index'))
|
|
||||||
else:
|
|
||||||
return redirect(url_for('core.index'))
|
|
||||||
|
|
||||||
form = LoginForm()
|
|
||||||
if form.validate_on_submit():
|
|
||||||
user = User.query.filter_by(username=form.username.data).first()
|
|
||||||
if user is None or not user.check_password(form.password.data):
|
|
||||||
flash('Invalid username or password', 'danger')
|
|
||||||
return redirect(url_for('auth.login'))
|
|
||||||
|
|
||||||
# Log the user in
|
|
||||||
login_user(user, remember=form.remember_me.data)
|
|
||||||
flash(f'Welcome back, {user.username}!', 'success')
|
|
||||||
|
|
||||||
# --- Redirect Logic Modified ---
|
|
||||||
next_page = request.args.get('next')
|
|
||||||
|
|
||||||
# IMPORTANT: Validate next_page to prevent Open Redirect attacks
|
|
||||||
# Ensure it's a relative path within our site
|
|
||||||
if next_page and not next_page.startswith('/'):
|
|
||||||
flash('Invalid redirect specified.', 'warning') # Optional feedback
|
|
||||||
next_page = None # Discard invalid or external URLs
|
|
||||||
|
|
||||||
# If no valid 'next' page was provided, determine default based on role
|
|
||||||
if not next_page:
|
|
||||||
if user.role == 'admin':
|
|
||||||
# Default redirect for admins
|
|
||||||
next_page = url_for('control_panel.index')
|
|
||||||
else:
|
|
||||||
# Default redirect for non-admins (e.g., 'user' role)
|
|
||||||
next_page = url_for('core.index')
|
|
||||||
# --- End of Modified Redirect Logic ---
|
|
||||||
|
|
||||||
return redirect(next_page)
|
|
||||||
|
|
||||||
# Render login template (GET request or failed POST validation)
|
|
||||||
# Assuming template is directly in blueprint's template folder
|
|
||||||
return render_template('login.html', title='Sign In', form=form)
|
|
||||||
|
|
||||||
@bp.route('/logout')
|
|
||||||
def logout():
|
|
||||||
logout_user()
|
|
||||||
flash('You have been logged out.', 'info')
|
|
||||||
return redirect(url_for('core.index'))
|
|
@ -1,43 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="container mt-4">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<h1>Sign In</h1>
|
|
||||||
<hr>
|
|
||||||
<form action="" method="post" novalidate>
|
|
||||||
{{ form.hidden_tag() }} <div class="mb-3">
|
|
||||||
{{ form.username.label(class="form-label") }}
|
|
||||||
{{ form.username(class="form-control" + (" is-invalid" if form.username.errors else ""), size=32) }}
|
|
||||||
{% if form.username.errors %}
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
{% for error in form.username.errors %}{{ error }}{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
{{ form.password.label(class="form-label") }}
|
|
||||||
{{ form.password(class="form-control" + (" is-invalid" if form.password.errors else ""), size=32) }}
|
|
||||||
{% if form.password.errors %}
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
{% for error in form.password.errors %}{{ error }}{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3 form-check">
|
|
||||||
{{ form.remember_me(class="form-check-input") }}
|
|
||||||
{{ form.remember_me.label(class="form-check-label") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
{{ form.submit(class="btn btn-primary") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -5,47 +5,6 @@ from werkzeug.security import generate_password_hash, check_password_hash
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class User(UserMixin, db.Model):
|
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
|
||||||
username = db.Column(db.String(64), index=True, unique=True)
|
|
||||||
email = db.Column(db.String(120), index=True, unique=True)
|
|
||||||
password_hash = db.Column(db.String(256))
|
|
||||||
# --- ADDED ROLE COLUMN ---
|
|
||||||
role = db.Column(db.String(20), index=True, default='user', nullable=False)
|
|
||||||
|
|
||||||
# Optional: Add a helper property for easy checking
|
|
||||||
@property
|
|
||||||
def is_admin(self):
|
|
||||||
return self.role == 'admin'
|
|
||||||
# --- END ROLE COLUMN ---
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
# You might want to include the role in the representation
|
|
||||||
return f'<User {self.username} ({self.role})>'
|
|
||||||
|
|
||||||
def set_password(self, password):
|
|
||||||
self.password_hash = generate_password_hash(password)
|
|
||||||
|
|
||||||
def check_password(self, password):
|
|
||||||
# Ensure password_hash is not None before checking
|
|
||||||
if self.password_hash is None:
|
|
||||||
return False
|
|
||||||
return check_password_hash(self.password_hash, password)
|
|
||||||
|
|
||||||
# Add this new model
|
|
||||||
class ModuleRegistry(db.Model):
|
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
|
||||||
module_id = db.Column(db.String(100), unique=True, nullable=False, index=True) # Matches folder name
|
|
||||||
is_enabled = db.Column(db.Boolean, default=False, nullable=False)
|
|
||||||
display_name = db.Column(db.String(100), nullable=True) # Optional override from metadata
|
|
||||||
description = db.Column(db.Text, nullable=True) # Optional override from metadata
|
|
||||||
version = db.Column(db.String(30), nullable=True) # Store version discovered
|
|
||||||
# Add timestamp for when it was first discovered or last updated?
|
|
||||||
# last_seen = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return f"<ModuleRegistry {self.module_id} (Enabled: {self.is_enabled})>"
|
|
||||||
|
|
||||||
# --- ProcessedIg Model (MODIFIED for Examples) ---
|
# --- ProcessedIg Model (MODIFIED for Examples) ---
|
||||||
class ProcessedIg(db.Model):
|
class ProcessedIg(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Single-database configuration for Flask.
|
|
@ -1,50 +0,0 @@
|
|||||||
# A generic, single database configuration.
|
|
||||||
|
|
||||||
[alembic]
|
|
||||||
# template used to generate migration files
|
|
||||||
# file_template = %%(rev)s_%%(slug)s
|
|
||||||
|
|
||||||
# set to 'true' to run the environment during
|
|
||||||
# the 'revision' command, regardless of autogenerate
|
|
||||||
# revision_environment = false
|
|
||||||
|
|
||||||
|
|
||||||
# Logging configuration
|
|
||||||
[loggers]
|
|
||||||
keys = root,sqlalchemy,alembic,flask_migrate
|
|
||||||
|
|
||||||
[handlers]
|
|
||||||
keys = console
|
|
||||||
|
|
||||||
[formatters]
|
|
||||||
keys = generic
|
|
||||||
|
|
||||||
[logger_root]
|
|
||||||
level = WARN
|
|
||||||
handlers = console
|
|
||||||
qualname =
|
|
||||||
|
|
||||||
[logger_sqlalchemy]
|
|
||||||
level = WARN
|
|
||||||
handlers =
|
|
||||||
qualname = sqlalchemy.engine
|
|
||||||
|
|
||||||
[logger_alembic]
|
|
||||||
level = INFO
|
|
||||||
handlers =
|
|
||||||
qualname = alembic
|
|
||||||
|
|
||||||
[logger_flask_migrate]
|
|
||||||
level = INFO
|
|
||||||
handlers =
|
|
||||||
qualname = flask_migrate
|
|
||||||
|
|
||||||
[handler_console]
|
|
||||||
class = StreamHandler
|
|
||||||
args = (sys.stderr,)
|
|
||||||
level = NOTSET
|
|
||||||
formatter = generic
|
|
||||||
|
|
||||||
[formatter_generic]
|
|
||||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
||||||
datefmt = %H:%M:%S
|
|
@ -1,113 +0,0 @@
|
|||||||
import logging
|
|
||||||
from logging.config import fileConfig
|
|
||||||
|
|
||||||
from flask import current_app
|
|
||||||
|
|
||||||
from alembic import context
|
|
||||||
|
|
||||||
# this is the Alembic Config object, which provides
|
|
||||||
# access to the values within the .ini file in use.
|
|
||||||
config = context.config
|
|
||||||
|
|
||||||
# Interpret the config file for Python logging.
|
|
||||||
# This line sets up loggers basically.
|
|
||||||
fileConfig(config.config_file_name)
|
|
||||||
logger = logging.getLogger('alembic.env')
|
|
||||||
|
|
||||||
|
|
||||||
def get_engine():
|
|
||||||
try:
|
|
||||||
# this works with Flask-SQLAlchemy<3 and Alchemical
|
|
||||||
return current_app.extensions['migrate'].db.get_engine()
|
|
||||||
except (TypeError, AttributeError):
|
|
||||||
# this works with Flask-SQLAlchemy>=3
|
|
||||||
return current_app.extensions['migrate'].db.engine
|
|
||||||
|
|
||||||
|
|
||||||
def get_engine_url():
|
|
||||||
try:
|
|
||||||
return get_engine().url.render_as_string(hide_password=False).replace(
|
|
||||||
'%', '%%')
|
|
||||||
except AttributeError:
|
|
||||||
return str(get_engine().url).replace('%', '%%')
|
|
||||||
|
|
||||||
|
|
||||||
# add your model's MetaData object here
|
|
||||||
# for 'autogenerate' support
|
|
||||||
# from myapp import mymodel
|
|
||||||
# target_metadata = mymodel.Base.metadata
|
|
||||||
config.set_main_option('sqlalchemy.url', get_engine_url())
|
|
||||||
target_db = current_app.extensions['migrate'].db
|
|
||||||
|
|
||||||
# other values from the config, defined by the needs of env.py,
|
|
||||||
# can be acquired:
|
|
||||||
# my_important_option = config.get_main_option("my_important_option")
|
|
||||||
# ... etc.
|
|
||||||
|
|
||||||
|
|
||||||
def get_metadata():
|
|
||||||
if hasattr(target_db, 'metadatas'):
|
|
||||||
return target_db.metadatas[None]
|
|
||||||
return target_db.metadata
|
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_offline():
|
|
||||||
"""Run migrations in 'offline' mode.
|
|
||||||
|
|
||||||
This configures the context with just a URL
|
|
||||||
and not an Engine, though an Engine is acceptable
|
|
||||||
here as well. By skipping the Engine creation
|
|
||||||
we don't even need a DBAPI to be available.
|
|
||||||
|
|
||||||
Calls to context.execute() here emit the given string to the
|
|
||||||
script output.
|
|
||||||
|
|
||||||
"""
|
|
||||||
url = config.get_main_option("sqlalchemy.url")
|
|
||||||
context.configure(
|
|
||||||
url=url, target_metadata=get_metadata(), literal_binds=True
|
|
||||||
)
|
|
||||||
|
|
||||||
with context.begin_transaction():
|
|
||||||
context.run_migrations()
|
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_online():
|
|
||||||
"""Run migrations in 'online' mode.
|
|
||||||
|
|
||||||
In this scenario we need to create an Engine
|
|
||||||
and associate a connection with the context.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# this callback is used to prevent an auto-migration from being generated
|
|
||||||
# when there are no changes to the schema
|
|
||||||
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
|
|
||||||
def process_revision_directives(context, revision, directives):
|
|
||||||
if getattr(config.cmd_opts, 'autogenerate', False):
|
|
||||||
script = directives[0]
|
|
||||||
if script.upgrade_ops.is_empty():
|
|
||||||
directives[:] = []
|
|
||||||
logger.info('No changes in schema detected.')
|
|
||||||
|
|
||||||
conf_args = current_app.extensions['migrate'].configure_args
|
|
||||||
if conf_args.get("process_revision_directives") is None:
|
|
||||||
conf_args["process_revision_directives"] = process_revision_directives
|
|
||||||
|
|
||||||
connectable = get_engine()
|
|
||||||
|
|
||||||
with connectable.connect() as connection:
|
|
||||||
context.configure(
|
|
||||||
connection=connection,
|
|
||||||
target_metadata=get_metadata(),
|
|
||||||
**conf_args
|
|
||||||
)
|
|
||||||
|
|
||||||
with context.begin_transaction():
|
|
||||||
context.run_migrations()
|
|
||||||
|
|
||||||
|
|
||||||
if context.is_offline_mode():
|
|
||||||
run_migrations_offline()
|
|
||||||
else:
|
|
||||||
run_migrations_online()
|
|
@ -1,24 +0,0 @@
|
|||||||
"""${message}
|
|
||||||
|
|
||||||
Revision ID: ${up_revision}
|
|
||||||
Revises: ${down_revision | comma,n}
|
|
||||||
Create Date: ${create_date}
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
${imports if imports else ""}
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = ${repr(up_revision)}
|
|
||||||
down_revision = ${repr(down_revision)}
|
|
||||||
branch_labels = ${repr(branch_labels)}
|
|
||||||
depends_on = ${repr(depends_on)}
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
${upgrades if upgrades else "pass"}
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
${downgrades if downgrades else "pass"}
|
|
@ -1,32 +0,0 @@
|
|||||||
"""Add must_support_elements_json to ProcessedIg
|
|
||||||
|
|
||||||
Revision ID: 5e6021b572ee
|
|
||||||
Revises: 8809253da459
|
|
||||||
Create Date: 2025-04-08 11:41:38.532125
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '5e6021b572ee'
|
|
||||||
down_revision = '8809253da459'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.add_column(sa.Column('must_support_elements_json', sa.Text(), nullable=True))
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.drop_column('must_support_elements_json')
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
@ -1,80 +0,0 @@
|
|||||||
"""Initial migration with User, ModuleRegistry, ProcessedIg
|
|
||||||
|
|
||||||
Revision ID: 7d0cdff4c7ad
|
|
||||||
Revises:
|
|
||||||
Create Date: 2025-04-08 08:35:33.204706
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '7d0cdff4c7ad'
|
|
||||||
down_revision = None
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('module_registry',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('module_id', sa.String(length=100), nullable=False),
|
|
||||||
sa.Column('is_enabled', sa.Boolean(), nullable=False),
|
|
||||||
sa.Column('display_name', sa.String(length=100), nullable=True),
|
|
||||||
sa.Column('description', sa.Text(), nullable=True),
|
|
||||||
sa.Column('version', sa.String(length=30), nullable=True),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
with op.batch_alter_table('module_registry', schema=None) as batch_op:
|
|
||||||
batch_op.create_index(batch_op.f('ix_module_registry_module_id'), ['module_id'], unique=True)
|
|
||||||
|
|
||||||
op.create_table('processed_ig',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('package_name', sa.String(length=150), nullable=False),
|
|
||||||
sa.Column('package_version', sa.String(length=50), nullable=False),
|
|
||||||
sa.Column('processed_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.Column('status', sa.String(length=50), nullable=True),
|
|
||||||
sa.Column('resource_types_json', sa.Text(), nullable=True),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('package_name', 'package_version', name='uq_processed_ig_name_version')
|
|
||||||
)
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.create_index(batch_op.f('ix_processed_ig_package_name'), ['package_name'], unique=False)
|
|
||||||
batch_op.create_index(batch_op.f('ix_processed_ig_package_version'), ['package_version'], unique=False)
|
|
||||||
|
|
||||||
op.create_table('user',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('username', sa.String(length=64), nullable=True),
|
|
||||||
sa.Column('email', sa.String(length=120), nullable=True),
|
|
||||||
sa.Column('password_hash', sa.String(length=256), nullable=True),
|
|
||||||
sa.Column('role', sa.String(length=20), nullable=False),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
||||||
batch_op.create_index(batch_op.f('ix_user_email'), ['email'], unique=True)
|
|
||||||
batch_op.create_index(batch_op.f('ix_user_role'), ['role'], unique=False)
|
|
||||||
batch_op.create_index(batch_op.f('ix_user_username'), ['username'], unique=True)
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
||||||
batch_op.drop_index(batch_op.f('ix_user_username'))
|
|
||||||
batch_op.drop_index(batch_op.f('ix_user_role'))
|
|
||||||
batch_op.drop_index(batch_op.f('ix_user_email'))
|
|
||||||
|
|
||||||
op.drop_table('user')
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.drop_index(batch_op.f('ix_processed_ig_package_version'))
|
|
||||||
batch_op.drop_index(batch_op.f('ix_processed_ig_package_name'))
|
|
||||||
|
|
||||||
op.drop_table('processed_ig')
|
|
||||||
with op.batch_alter_table('module_registry', schema=None) as batch_op:
|
|
||||||
batch_op.drop_index(batch_op.f('ix_module_registry_module_id'))
|
|
||||||
|
|
||||||
op.drop_table('module_registry')
|
|
||||||
# ### end Alembic commands ###
|
|
@ -1,34 +0,0 @@
|
|||||||
"""Rename resource_types_json to resource_types_info_json in ProcessedIg
|
|
||||||
|
|
||||||
Revision ID: 8809253da459
|
|
||||||
Revises: 7d0cdff4c7ad
|
|
||||||
Create Date: 2025-04-08 09:20:55.669990
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '8809253da459'
|
|
||||||
down_revision = '7d0cdff4c7ad'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.add_column(sa.Column('resource_types_info_json', sa.Text(), nullable=True))
|
|
||||||
batch_op.drop_column('resource_types_json')
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.add_column(sa.Column('resource_types_json', sa.TEXT(), nullable=True))
|
|
||||||
batch_op.drop_column('resource_types_info_json')
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||||||
"""Add examples_json to ProcessedIg
|
|
||||||
|
|
||||||
Revision ID: d8f620f74fbe
|
|
||||||
Revises: 5e6021b572ee
|
|
||||||
Create Date: 2025-04-08 12:45:21.475913
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = 'd8f620f74fbe'
|
|
||||||
down_revision = '5e6021b572ee'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.add_column(sa.Column('examples_json', sa.Text(), nullable=True))
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
with op.batch_alter_table('processed_ig', schema=None) as batch_op:
|
|
||||||
batch_op.drop_column('examples_json')
|
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
|
Loading…
x
Reference in New Issue
Block a user