-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ refactor(
db/migration
): Organize SQL migration scripts and enhanc…
…e zhparser extension setup with additional configurations and custom word initialization.
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
.../platform/src/main/resources/zhparser.sql → ...ources/db/migration/V1.0.1__extension.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
boot/platform/src/main/resources/db/migration/V1.0.4__InitTestData.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
do | ||
$do$ | ||
declare | ||
v_code varchar(32); | ||
v_phone varchar(32); | ||
batch_size INTEGER := 10000; | ||
batch_count INTEGER := 0; | ||
begin | ||
for i in 1..100000 | ||
loop | ||
-- 生成用户代码 | ||
if i < 1000 then | ||
v_code := 'U' || lpad(i::text, 4, '0'); | ||
else | ||
v_code := 'U' || (i + 3)::text; | ||
end if; | ||
|
||
-- 生成手机号码 | ||
v_phone := '1708911826' || lpad(i::text, 2, '0'); | ||
|
||
-- 插入用户数据 | ||
insert into se_users(code, username, password, name, phone, email, bio, creator, updater) | ||
values (gen_random_uuid(), 'user' || i, | ||
'{pbkdf2}7d8a68bc5d507bd19bc153ff10bcdef66f5a5f3d0c1ab2438630e50b5c65894bccc2c7e4404c5afa', | ||
'普通用户' || i, v_phone, 'user' || i || '@qq.com', null, | ||
'f47ac10b-58cc-4372-a567-0e02b2c3d479', 'f47ac10b-58cc-4372-a567-0e02b2c3d479'); | ||
batch_count := batch_count + 1; | ||
if (batch_count % batch_size = 0) then | ||
commit; | ||
end if; | ||
end loop; | ||
commit; | ||
end; | ||
$do$; |
1 change: 1 addition & 0 deletions
1
boot/platform/src/main/resources/db/migration/V1.0.4__InitTestData.sql.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
executeInTransaction=false |