mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 15:39:05 +08:00
chore: update SQLAlchemy configuration with custom naming convention (#6854)
This commit is contained in:
parent
56b43f62d1
commit
feb4576ee7
@ -1,6 +1,16 @@
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy import MetaData
|
||||
|
||||
db = SQLAlchemy()
|
||||
POSTGRES_INDEXES_NAMING_CONVENTION = {
|
||||
'ix': '%(column_0_label)s_idx',
|
||||
'uq': '%(table_name)s_%(column_0_name)s_key',
|
||||
'ck': '%(table_name)s_%(constraint_name)s_check',
|
||||
'fk': '%(table_name)s_%(column_0_name)s_fkey',
|
||||
'pk': '%(table_name)s_pkey',
|
||||
}
|
||||
|
||||
metadata = MetaData(naming_convention=POSTGRES_INDEXES_NAMING_CONVENTION)
|
||||
db = SQLAlchemy(metadata=metadata)
|
||||
|
||||
|
||||
def init_app(app):
|
||||
|
@ -3,6 +3,7 @@
|
||||
[alembic]
|
||||
# template used to generate migration files
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
|
||||
|
||||
# set to 'true' to run the environment during
|
||||
# the 'revision' command, regardless of autogenerate
|
||||
|
Loading…
x
Reference in New Issue
Block a user