File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ spring-ai-alibaba-nl2sql/
30
30
31
31
### 2. 配置management数据库
32
32
33
- 在` spring-ai-alibaba-nl2sql-management/src/main/resources/application.yml ` 中配置你的MySQL数据库连接信息
33
+ 在` spring-ai-alibaba-nl2sql-management/src/main/resources/application.yml ` 中配置你的MySQL数据库连接信息。
34
34
35
- > 目前程序会自动创建表和数据,所以不需要手动创建 。
35
+ > 初始化行为说明:默认开启自动创建表并插入示例数据( ` spring.sql.init.mode: always ` )。生产环境建议关闭,避免示例数据回填覆盖你的业务数据 。
36
36
37
37
``` yaml
38
38
spring :
@@ -44,6 +44,35 @@ spring:
44
44
type : com.alibaba.druid.pool.DruidDataSource
45
45
` ` `
46
46
47
+ ### 2.1 可选:启用/关闭自动初始化(schema.sql + data.sql)
48
+
49
+ - 默认配置:` application.yml` 中已设置为开启
50
+
51
+ ` ` ` yaml
52
+ spring:
53
+ sql:
54
+ init:
55
+ mode: always # 默认:每次启动执行 schema.sql 与 data.sql
56
+ schema-locations: classpath:sql/schema.sql
57
+ data-locations: classpath:sql/data.sql
58
+ ` ` `
59
+
60
+ - 若不希望每次启动回填示例数据,可将 `mode` 改为 `never` 关闭:
61
+
62
+ ` ` ` yaml
63
+ spring:
64
+ sql:
65
+ init:
66
+ mode: never # 关闭自动初始化
67
+ schema-locations: classpath:sql/schema.sql
68
+ data-locations: classpath:sql/data.sql
69
+ ` ` `
70
+
71
+ 注意:默认开启时(`mode : always`),`data.sql` 会在每次启动回填示例数据(即使你手动删除了数据)。生产环境请改为 `mode: never`,避免覆盖/复原业务数据。
72
+
73
+ 
74
+
75
+
47
76
# ## 3. 配置 API Key
48
77
49
78
` ` ` yaml
You can’t perform that action at this time.
0 commit comments