Added OpenAI large embedding / improve migration and upgrade handling for containers
This commit is contained in:
4
.env
Normal file
4
.env
Normal file
@@ -0,0 +1,4 @@
|
||||
DB_HOST=localhost
|
||||
DB_USER=luke
|
||||
DB_PASS=Skywalker!
|
||||
DB_NAME=eveai
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -97,3 +97,16 @@ class EmbeddingSmallOpenAI(Embedding):
|
||||
__mapper_args__ = {
|
||||
'polymorphic_identity': 'embedding_small_openai',
|
||||
}
|
||||
|
||||
|
||||
class EmbeddingLargeOpenAI(Embedding):
|
||||
__tablename__ = 'embedding_large_openai'
|
||||
id = db.Column(db.Integer, db.ForeignKey('embeddings.id'), primary_key=True)
|
||||
|
||||
# 3072 is the OpenAI Large Embedding dimension.
|
||||
# If another embedding model is chosen, this dimension may need to be changed.
|
||||
embedding = db.Column(Vector(3072), nullable=False)
|
||||
|
||||
__mapper_args__ = {
|
||||
'polymorphic_identity': 'embedding_large_openai',
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -71,6 +71,8 @@ class Config(object):
|
||||
# Chunk Definition, Embedding dependent
|
||||
OAI_TE3S_MIN_CHUNK_SIZE = 2000
|
||||
OAI_TE3S_MAX_CHUNK_SIZE = 3000
|
||||
OAI_TE3L_MIN_CHUNK_SIZE = 3000
|
||||
OAI_TE3L_MAX_CHUNK_SIZE = 4000
|
||||
|
||||
# LLM TEMPLATES
|
||||
GPT4_SUMMARY_TEMPLATE = """Write a concise summary of the text in {language}. The text is delimited between triple backquotes.
|
||||
@@ -182,8 +184,13 @@ class DevConfig(Config):
|
||||
DEBUG = True
|
||||
FLASK_DEBUG = True
|
||||
PYCHARM_DEBUG = False
|
||||
SQLALCHEMY_DATABASE_URI = 'postgresql+pg8000://luke:Skywalker!@db:5432/eveai'
|
||||
SQLALCHEMY_BINDS = {'public': 'postgresql+pg8000://luke:Skywalker!@db:5432/eveai'}
|
||||
DB_HOST = environ.get('DB_HOST', 'localhost')
|
||||
DB_USER = environ.get('DB_USER', 'luke')
|
||||
DB_PASS = environ.get('DB_PASS', 'Skywalker!')
|
||||
DB_NAME = environ.get('DB_NAME', 'eveai')
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = f'postgresql+pg8000://{DB_USER}:{DB_PASS}@{DB_HOST}:5432/{DB_NAME}'
|
||||
SQLALCHEMY_BINDS = {'public': SQLALCHEMY_DATABASE_URI}
|
||||
EXPLAIN_TEMPLATE_LOADING = False
|
||||
|
||||
# Define the nginx prefix used for the specific apps
|
||||
|
||||
BIN
docker/.DS_Store
vendored
BIN
docker/.DS_Store
vendored
Binary file not shown.
@@ -32,6 +32,10 @@ services:
|
||||
environment:
|
||||
- FLASK_ENV=development
|
||||
- FLASK_DEBUG=1
|
||||
- DB_HOST=db
|
||||
- DB_USER=luke
|
||||
- DB_PASS=Skywalker!
|
||||
- DB_NAME=eveai
|
||||
volumes:
|
||||
- ../eveai_app:/app/eveai_app
|
||||
- ../common:/app/common
|
||||
|
||||
BIN
docker/db/.DS_Store
vendored
BIN
docker/db/.DS_Store
vendored
Binary file not shown.
BIN
eveai_app/.DS_Store
vendored
BIN
eveai_app/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
logs/embed_tuning.log
Normal file
0
logs/embed_tuning.log
Normal file
66
logs/eveai_app.log
Normal file
66
logs/eveai_app.log
Normal file
@@ -0,0 +1,66 @@
|
||||
2024-07-04 09:28:59,334 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 09:28:59,353 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 09:28:59,353 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 09:28:59,353 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 09:28:59,353 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 09:28:59,353 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 09:28:59,354 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 09:28:59,362 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 09:28:59,362 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 09:28:59,399 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 09:28:59,399 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
2024-07-04 09:30:12,852 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 09:30:12,870 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 09:30:12,874 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 09:30:12,875 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 09:30:12,893 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 09:30:12,893 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
2024-07-04 09:30:23,727 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 09:30:23,739 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 09:30:23,740 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 09:30:23,740 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 09:30:23,740 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 09:30:23,740 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 09:30:23,740 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 09:30:23,744 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 09:30:23,744 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 09:30:23,762 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 09:30:23,762 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
2024-07-04 15:47:58,346 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 15:47:58,365 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 15:47:58,383 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 15:47:58,383 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 15:47:58,406 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 15:47:58,406 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
2024-07-04 15:48:39,272 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 15:48:39,284 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 15:48:39,284 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 15:48:39,284 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 15:48:39,285 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 15:48:39,285 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 15:48:39,285 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 15:48:39,289 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 15:48:39,289 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 15:48:39,307 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 15:48:39,308 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
2024-07-04 15:49:43,236 [INFO] eveai_app: eveai_app starting up
|
||||
2024-07-04 15:49:43,248 [INFO] eveai_app: Project ID: eveai-420711
|
||||
2024-07-04 15:49:43,248 [INFO] eveai_app: Location: europe-west1
|
||||
2024-07-04 15:49:43,248 [INFO] eveai_app: Key Ring: eveai-chat
|
||||
2024-07-04 15:49:43,248 [INFO] eveai_app: Crypto Key: envelope-encryption-key
|
||||
2024-07-04 15:49:43,249 [INFO] eveai_app: Key Name: projects/eveai-420711/locations/europe-west1/keyRings/eveai-chat/cryptoKeys/envelope-encryption-key
|
||||
2024-07-04 15:49:43,249 [INFO] eveai_app: Service Account Key Path: None
|
||||
2024-07-04 15:49:43,253 [DEBUG] eveai_app: CELERY_BROKER_URL: redis://redis:6379/0
|
||||
2024-07-04 15:49:43,253 [DEBUG] eveai_app: CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
2024-07-04 15:49:43,271 [INFO] eveai_app: EveAI App Server Started Successfully
|
||||
2024-07-04 15:49:43,271 [INFO] eveai_app: -------------------------------------------------------------------------------------------------
|
||||
0
logs/eveai_chat.log
Normal file
0
logs/eveai_chat.log
Normal file
0
logs/eveai_chat_workers.log
Normal file
0
logs/eveai_chat_workers.log
Normal file
0
logs/eveai_workers.log
Normal file
0
logs/eveai_workers.log
Normal file
0
logs/mailman.log
Normal file
0
logs/mailman.log
Normal file
0
logs/rag_tuning.log
Normal file
0
logs/rag_tuning.log
Normal file
0
logs/security.log
Normal file
0
logs/security.log
Normal file
0
logs/sqlalchemy.log
Normal file
0
logs/sqlalchemy.log
Normal file
BIN
migrations/.DS_Store
vendored
BIN
migrations/.DS_Store
vendored
Binary file not shown.
BIN
migrations/public/.DS_Store
vendored
BIN
migrations/public/.DS_Store
vendored
Binary file not shown.
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:42:15Z
|
||||
|
||||
Revision ID: 167d821471ed
|
||||
Revises: e76f189a6489
|
||||
Create Date: 2024-07-04 09:42:16.959346
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '167d821471ed'
|
||||
down_revision = 'e76f189a6489'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:21:49Z
|
||||
|
||||
Revision ID: 1751a5318d34
|
||||
Revises: df7bd57b7ae8
|
||||
Create Date: 2024-07-04 09:21:50.715334
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1751a5318d34'
|
||||
down_revision = 'df7bd57b7ae8'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:43:14Z
|
||||
|
||||
Revision ID: 2a18dab7d1a4
|
||||
Revises: 167d821471ed
|
||||
Create Date: 2024-07-04 09:43:16.445891
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2a18dab7d1a4'
|
||||
down_revision = '167d821471ed'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:38:14Z
|
||||
|
||||
Revision ID: 38b9e73d847f
|
||||
Revises: d93eab8ce138
|
||||
Create Date: 2024-07-04 09:38:16.081254
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '38b9e73d847f'
|
||||
down_revision = 'd93eab8ce138'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T12:47:41Z
|
||||
|
||||
Revision ID: 668e4a1000cb
|
||||
Revises: 89a287bbd574
|
||||
Create Date: 2024-07-04 12:47:42.696406
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '668e4a1000cb'
|
||||
down_revision = '89a287bbd574'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T12:28:00Z
|
||||
|
||||
Revision ID: 89a287bbd574
|
||||
Revises: cda254aa11ec
|
||||
Create Date: 2024-07-04 12:28:01.628253
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '89a287bbd574'
|
||||
down_revision = 'cda254aa11ec'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T12:51:36Z
|
||||
|
||||
Revision ID: 8ab72fe23ee4
|
||||
Revises: 668e4a1000cb
|
||||
Create Date: 2024-07-04 12:51:37.394042
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8ab72fe23ee4'
|
||||
down_revision = '668e4a1000cb'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:59:04Z
|
||||
|
||||
Revision ID: cda254aa11ec
|
||||
Revises: 2a18dab7d1a4
|
||||
Create Date: 2024-07-04 09:59:05.543007
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cda254aa11ec'
|
||||
down_revision = '2a18dab7d1a4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:36:42Z
|
||||
|
||||
Revision ID: d93eab8ce138
|
||||
Revises: ff206102492b
|
||||
Create Date: 2024-07-04 09:36:44.423035
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd93eab8ce138'
|
||||
down_revision = 'ff206102492b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:08:45Z
|
||||
|
||||
Revision ID: df7bd57b7ae8
|
||||
Revises: edb5953e3438
|
||||
Create Date: 2024-07-04 09:08:47.284217
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'df7bd57b7ae8'
|
||||
down_revision = 'edb5953e3438'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:40:45Z
|
||||
|
||||
Revision ID: e76f189a6489
|
||||
Revises: 38b9e73d847f
|
||||
Create Date: 2024-07-04 09:40:46.984037
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e76f189a6489'
|
||||
down_revision = '38b9e73d847f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T08:18:50Z
|
||||
|
||||
Revision ID: edb5953e3438
|
||||
Revises: fdc9ac232c49
|
||||
Create Date: 2024-07-04 08:18:51.422112
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'edb5953e3438'
|
||||
down_revision = 'fdc9ac232c49'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T07:39:16Z
|
||||
|
||||
Revision ID: fdc9ac232c49
|
||||
Revises: 358bb5f8ebf1
|
||||
Create Date: 2024-07-04 07:39:18.468658
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'fdc9ac232c49'
|
||||
down_revision = '358bb5f8ebf1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,62 @@
|
||||
"""2024-07-04T09:28:42Z
|
||||
|
||||
Revision ID: ff206102492b
|
||||
Revises: 1751a5318d34
|
||||
Create Date: 2024-07-04 09:28:44.437097
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ff206102492b'
|
||||
down_revision = '1751a5318d34'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
|
||||
# ### 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_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('tenant_domain', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id'])
|
||||
batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('roles_users', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
BIN
migrations/tenant/.DS_Store
vendored
BIN
migrations/tenant/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
@@ -99,6 +99,16 @@ def run_migrations_online():
|
||||
poolclass=NullPool,
|
||||
)
|
||||
|
||||
def process_revision_directives(context, revision, directives):
|
||||
if config.cmd_opts.autogenerate:
|
||||
script = directives[0]
|
||||
if script.upgrade_ops is not None:
|
||||
# Add import for pgvector and set search path
|
||||
script.upgrade_ops.ops.insert(0, sa.schema.ExecuteSQLOp(
|
||||
"SET search_path TO CURRENT_SCHEMA(), public; IMPORT pgvector",
|
||||
execution_options=None
|
||||
))
|
||||
|
||||
with connectable.connect() as connection:
|
||||
print(tenants)
|
||||
for tenant in tenants:
|
||||
@@ -106,17 +116,18 @@ def run_migrations_online():
|
||||
# set search path on the connection, which ensures that
|
||||
# PostgreSQL will emit all CREATE / ALTER / DROP statements
|
||||
# in terms of this schema by default
|
||||
connection.execute(text(f'SET search_path TO "{tenant}"'))
|
||||
connection.execute(text(f'SET search_path TO "{tenant}", public'))
|
||||
# in SQLAlchemy v2+ the search path change needs to be committed
|
||||
connection.commit()
|
||||
|
||||
# make use of non-supported SQLAlchemy attribute to ensure
|
||||
# the dialect reflects tables in terms of the current tenant name
|
||||
connection.dialect.default_schema_name = tenant
|
||||
connection.dialect.default_schema_name = str(tenant)
|
||||
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=get_metadata(),
|
||||
process_revision_directives=process_revision_directives,
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
|
||||
@@ -7,6 +7,7 @@ Create Date: ${create_date}
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import pgvector
|
||||
${imports if imports else ""}
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Add Embedding model for OpenAI large model
|
||||
|
||||
Revision ID: 5d5437d81041
|
||||
Revises: d173cea8d204
|
||||
Create Date: 2024-07-04 15:49:43.665685
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import pgvector
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5d5437d81041'
|
||||
down_revision = 'd173cea8d204'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('embedding_large_openai',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('embedding', pgvector.sqlalchemy.Vector(dim=3072), nullable=False),
|
||||
sa.ForeignKeyConstraint(['id'], ['embeddings.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('embedding_large_openai')
|
||||
# ### end Alembic commands ###
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,18 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: ./migrate.sh -m "Your migration message" -d migrations/public
|
||||
# Usage: ./db_migrate.sh -m "Your migration message" -d migrations/public
|
||||
|
||||
cd "/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/" || exit 1
|
||||
source "/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/.venv/bin/activate"
|
||||
# Load environment variables
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
|
||||
project_dir=$(pwd)
|
||||
# Ensure you're in the correct directory
|
||||
cd "$project_dir" || exit 1
|
||||
|
||||
# Load environment variables (including database connection details)
|
||||
source .env
|
||||
|
||||
# Set Flask app and Python path
|
||||
export FLASK_APP=scripts/run_eveai_app.py
|
||||
export PYTHONPATH="$PYTHONPATH:$project_dir"
|
||||
|
||||
while getopts m:d: flag
|
||||
do
|
||||
case "${flag}" in
|
||||
m) message=${OPTARG};;
|
||||
d) directory=${OPTARG};;
|
||||
*) # Catch-all for unexpected arguments
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
echo "Usage: ./migrate.sh -m \"Your migration message\" -d migrations/public"
|
||||
*)
|
||||
echo "Invalid option: ${flag}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -21,13 +33,9 @@ done
|
||||
# Check if the message and directory are provided
|
||||
if [ -z "$message" ] || [ -z "$directory" ]; then
|
||||
echo "Both message and directory are required."
|
||||
echo "Usage: ./migrate.sh -m \"Your migration message\" -d migrations/public"
|
||||
echo "Usage: ./db_migrate.sh -m \"Your migration message\" -d migrations/public"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set FLASK_APP environment variable
|
||||
export FLASK_APP=scripts/run_eveai_app.py # Modify if your Flask app is initiated differently
|
||||
export PYTHONPATH="$PYTHONPATH:/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/"
|
||||
|
||||
# Run the Flask migration command
|
||||
flask db migrate -m "$message" -d "$directory"
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: ./upgrade.sh -d migrations/public
|
||||
|
||||
cd "/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/" || exit 1
|
||||
source "/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/.venv/bin/activate"
|
||||
|
||||
while getopts d: flag
|
||||
do
|
||||
case "${flag}" in
|
||||
d) directory=${OPTARG};;
|
||||
*) # Catch-all for unexpected arguments
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
echo "Usage: ./upgrade.sh -d migrations/public"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if the directory is provided
|
||||
if [ -z "$directory" ]; then
|
||||
echo "Directory parameter is required."
|
||||
echo "Usage: ./upgrade.sh -d migrations/public"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set FLASK_APP environment variable
|
||||
export FLASK_APP=scripts/run_eveai_app.py # Modify if your Flask app is initiated differently
|
||||
export PYTHONPATH="$PYTHONPATH:/Volumes/OWC4M2_1/Dropbox/Josako's Dev/Josako/EveAI/Development/eveAI/"
|
||||
|
||||
# Run the Flask upgrade command
|
||||
flask db upgrade -d "$directory"
|
||||
Reference in New Issue
Block a user