mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-04-21 21:29:48 +08:00

Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: -LAN- <laipz8200@outlook.com>
20 lines
529 B
Python
20 lines
529 B
Python
from flask_sqlalchemy import SQLAlchemy
|
|
from sqlalchemy import MetaData
|
|
|
|
from dify_app import DifyApp
|
|
|
|
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: DifyApp):
|
|
db.init_app(app)
|