create-entity-server 0.7.11 → 0.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-entity-server",
3
- "version": "0.7.11",
3
+ "version": "0.7.12",
4
4
  "description": "Create a new entity-server project in one command — like create-react-app or create-vite.",
5
5
  "keywords": [
6
6
  "entity-server",
@@ -11,6 +11,12 @@
11
11
  "type": ["none", "pending", "synced", "failed", "skipped"],
12
12
  "default": "none"
13
13
  },
14
+ "is_public": {
15
+ "index_only": true,
16
+ "comment": "공개 파일 여부 (인증 없이 GET 접근 가능)",
17
+ "type": "boolean",
18
+ "default": false
19
+ },
14
20
  "size": {
15
21
  "index": true,
16
22
  "comment": "파일 크기 (bytes)",
@@ -1,123 +1,123 @@
1
- # API Key Management Script (CLI mode) - Windows PowerShell
2
- # Can be used even when the server is stopped.
3
- param(
4
- [Parameter(Position=0)]
5
- [string]$SubCommand = ""
6
- )
7
-
8
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
9
- $ProjectRoot = Split-Path -Parent $ScriptDir
10
- $BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
11
-
12
- Set-Location $ProjectRoot
13
-
14
- # Load language from .env
15
- $Language = "ko"
16
- $EnvFile = Join-Path $ProjectRoot ".env"
17
- if (Test-Path $EnvFile) {
18
- $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
19
- if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
20
- }
21
-
22
- function Show-Help {
23
- if ($Language -eq "en") {
24
- Write-Host "API Key Management (CLI mode)"
25
- Write-Host "============================="
26
- Write-Host ""
27
- Write-Host "Manage api_keys entity directly via CLI binary."
28
- Write-Host "Server does NOT need to be running."
29
- Write-Host ""
30
- Write-Host "Usage: .\api-key.ps1 <subcommand> [options]"
31
- Write-Host ""
32
- Write-Host "Subcommands:"
33
- Write-Host " list List API keys"
34
- Write-Host " add Create a new API key (key/secret auto-generated)"
35
- Write-Host " delete Delete an API key by seq"
36
- Write-Host " help Show this help"
37
- Write-Host ""
38
- Write-Host "list options:"
39
- Write-Host " --limit=<n> Max rows to show (default: 20)"
40
- Write-Host ""
41
- Write-Host "add options:"
42
- Write-Host " --role=<name> Role name (default: admin)"
43
- Write-Host " --entities=<json> Allowed entities JSON (default: [`"*`"])"
44
- Write-Host " --description=<t> Description"
45
- Write-Host " --user-seq=<n> Associated user seq"
46
- Write-Host " --apply Execute (default is dry-run)"
47
- Write-Host ""
48
- Write-Host "delete options:"
49
- Write-Host " --seq=<n> API key seq to delete (required)"
50
- Write-Host " --apply Execute (default is dry-run)"
51
- Write-Host ""
52
- Write-Host "Examples:"
53
- Write-Host " .\api-key.ps1 list"
54
- Write-Host " .\api-key.ps1 list --limit=50"
55
- Write-Host " .\api-key.ps1 add --role=admin --apply"
56
- Write-Host " .\api-key.ps1 delete --seq=3 --apply"
57
- } else {
58
- Write-Host "API 키 관리 (CLI 모드)"
59
- Write-Host "===================="
60
- Write-Host ""
61
- Write-Host "CLI 바이너리로 api_keys 엔티티를 직접 조작합니다."
62
- Write-Host "서버가 실행 중이지 않아도 사용 가능합니다."
63
- Write-Host ""
64
- Write-Host "사용법: .\api-key.ps1 <하위명령> [옵션]"
65
- Write-Host ""
66
- Write-Host "하위 명령:"
67
- Write-Host " list API 키 목록 조회"
68
- Write-Host " add 새 API 키 생성 (키/시크릿 자동 생성)"
69
- Write-Host " delete API 키 삭제 (seq 지정)"
70
- Write-Host " help 도움말 출력"
71
- Write-Host ""
72
- Write-Host "list 옵션:"
73
- Write-Host " --limit=<n> 최대 출력 행 수 (기본: 20)"
74
- Write-Host ""
75
- Write-Host "add 옵션:"
76
- Write-Host " --role=<이름> 역할명 (기본: admin)"
77
- Write-Host " --entities=<json> 허용 엔티티 JSON (기본: [`"*`"])"
78
- Write-Host " --description=<t> 설명"
79
- Write-Host " --user-seq=<n> 연결 사용자 seq"
80
- Write-Host " --apply 실제 실행 (기본: dry-run)"
81
- Write-Host ""
82
- Write-Host "delete 옵션:"
83
- Write-Host " --seq=<n> 삭제할 API 키 seq (필수)"
84
- Write-Host " --apply 실제 실행 (기본: dry-run)"
85
- Write-Host ""
86
- Write-Host "예제:"
87
- Write-Host " .\api-key.ps1 list"
88
- Write-Host " .\api-key.ps1 list --limit=50"
89
- Write-Host " .\api-key.ps1 add --role=admin --apply"
90
- Write-Host " .\api-key.ps1 delete --seq=3 --apply"
91
- }
92
- }
93
-
94
- if (-not $SubCommand) {
95
- Show-Help
96
- exit 0
97
- }
98
-
99
- if (-not (Test-Path $BinPath)) {
100
- if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found. Run: .\scripts\build.ps1" }
101
- else { Write-Host "X bin/entity-cli.exe 파일이 없습니다. 먼저 .\scripts\build.ps1 를 실행하세요." }
102
- exit 1
103
- }
104
-
105
- # Collect remaining args (all args after SubCommand)
106
- $remainingArgs = $args
107
-
108
- switch ($SubCommand) {
109
- { $_ -in @("list", "show", "add", "delete") } {
110
- $env:ENTITY_CLI_NAME = "api-key"
111
- & $BinPath api-key $SubCommand @remainingArgs
112
- }
113
- { $_ -in @("help", "-h", "--help") } {
114
- Show-Help
115
- }
116
- default {
117
- if ($Language -eq "en") { Write-Host "X Unknown subcommand: $SubCommand" }
118
- else { Write-Host "X 알 수 없는 하위 명령: $SubCommand" }
119
- Write-Host ""
120
- Show-Help
121
- exit 1
122
- }
123
- }
1
+ # API Key Management Script (CLI mode) - Windows PowerShell
2
+ # Can be used even when the server is stopped.
3
+ param(
4
+ [Parameter(Position=0)]
5
+ [string]$SubCommand = ""
6
+ )
7
+
8
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
9
+ $ProjectRoot = Split-Path -Parent $ScriptDir
10
+ $BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
11
+
12
+ Set-Location $ProjectRoot
13
+
14
+ # Load language from .env
15
+ $Language = "ko"
16
+ $EnvFile = Join-Path $ProjectRoot ".env"
17
+ if (Test-Path $EnvFile) {
18
+ $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
19
+ if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
20
+ }
21
+
22
+ function Show-Help {
23
+ if ($Language -eq "en") {
24
+ Write-Host "API Key Management (CLI mode)"
25
+ Write-Host "============================="
26
+ Write-Host ""
27
+ Write-Host "Manage api_keys entity directly via CLI binary."
28
+ Write-Host "Server does NOT need to be running."
29
+ Write-Host ""
30
+ Write-Host "Usage: .\api-key.ps1 <subcommand> [options]"
31
+ Write-Host ""
32
+ Write-Host "Subcommands:"
33
+ Write-Host " list List API keys"
34
+ Write-Host " add Create a new API key (key/secret auto-generated)"
35
+ Write-Host " delete Delete an API key by seq"
36
+ Write-Host " help Show this help"
37
+ Write-Host ""
38
+ Write-Host "list options:"
39
+ Write-Host " --limit=<n> Max rows to show (default: 20)"
40
+ Write-Host ""
41
+ Write-Host "add options:"
42
+ Write-Host " --role=<name> Role name (default: admin)"
43
+ Write-Host " --entities=<json> Allowed entities JSON (default: [`"*`"])"
44
+ Write-Host " --description=<t> Description"
45
+ Write-Host " --user-seq=<n> Associated user seq"
46
+ Write-Host " --apply Execute (default is dry-run)"
47
+ Write-Host ""
48
+ Write-Host "delete options:"
49
+ Write-Host " --seq=<n> API key seq to delete (required)"
50
+ Write-Host " --apply Execute (default is dry-run)"
51
+ Write-Host ""
52
+ Write-Host "Examples:"
53
+ Write-Host " .\api-key.ps1 list"
54
+ Write-Host " .\api-key.ps1 list --limit=50"
55
+ Write-Host " .\api-key.ps1 add --role=admin --apply"
56
+ Write-Host " .\api-key.ps1 delete --seq=3 --apply"
57
+ } else {
58
+ Write-Host "API 키 관리 (CLI 모드)"
59
+ Write-Host "===================="
60
+ Write-Host ""
61
+ Write-Host "CLI 바이너리로 api_keys 엔티티를 직접 조작합니다."
62
+ Write-Host "서버가 실행 중이지 않아도 사용 가능합니다."
63
+ Write-Host ""
64
+ Write-Host "사용법: .\api-key.ps1 <하위명령> [옵션]"
65
+ Write-Host ""
66
+ Write-Host "하위 명령:"
67
+ Write-Host " list API 키 목록 조회"
68
+ Write-Host " add 새 API 키 생성 (키/시크릿 자동 생성)"
69
+ Write-Host " delete API 키 삭제 (seq 지정)"
70
+ Write-Host " help 도움말 출력"
71
+ Write-Host ""
72
+ Write-Host "list 옵션:"
73
+ Write-Host " --limit=<n> 최대 출력 행 수 (기본: 20)"
74
+ Write-Host ""
75
+ Write-Host "add 옵션:"
76
+ Write-Host " --role=<이름> 역할명 (기본: admin)"
77
+ Write-Host " --entities=<json> 허용 엔티티 JSON (기본: [`"*`"])"
78
+ Write-Host " --description=<t> 설명"
79
+ Write-Host " --user-seq=<n> 연결 사용자 seq"
80
+ Write-Host " --apply 실제 실행 (기본: dry-run)"
81
+ Write-Host ""
82
+ Write-Host "delete 옵션:"
83
+ Write-Host " --seq=<n> 삭제할 API 키 seq (필수)"
84
+ Write-Host " --apply 실제 실행 (기본: dry-run)"
85
+ Write-Host ""
86
+ Write-Host "예제:"
87
+ Write-Host " .\api-key.ps1 list"
88
+ Write-Host " .\api-key.ps1 list --limit=50"
89
+ Write-Host " .\api-key.ps1 add --role=admin --apply"
90
+ Write-Host " .\api-key.ps1 delete --seq=3 --apply"
91
+ }
92
+ }
93
+
94
+ if (-not $SubCommand) {
95
+ Show-Help
96
+ exit 0
97
+ }
98
+
99
+ if (-not (Test-Path $BinPath)) {
100
+ if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found. Run: .\scripts\build.ps1" }
101
+ else { Write-Host "X bin/entity-cli.exe 파일이 없습니다. 먼저 .\scripts\build.ps1 를 실행하세요." }
102
+ exit 1
103
+ }
104
+
105
+ # Collect remaining args (all args after SubCommand)
106
+ $remainingArgs = $args
107
+
108
+ switch ($SubCommand) {
109
+ { $_ -in @("list", "show", "add", "delete") } {
110
+ $env:ENTITY_CLI_NAME = "api-key"
111
+ & $BinPath api-key $SubCommand @remainingArgs
112
+ }
113
+ { $_ -in @("help", "-h", "--help") } {
114
+ Show-Help
115
+ }
116
+ default {
117
+ if ($Language -eq "en") { Write-Host "X Unknown subcommand: $SubCommand" }
118
+ else { Write-Host "X 알 수 없는 하위 명령: $SubCommand" }
119
+ Write-Host ""
120
+ Show-Help
121
+ exit 1
122
+ }
123
+ }
@@ -1,69 +1,69 @@
1
- # cleanup-history.ps1 — history_ttl 기준 이력 정리
2
- #
3
- # 사용법:
4
- # .\scripts\cleanup-history.ps1 # 도움말
5
- # .\scripts\cleanup-history.ps1 --apply # 전체 이력 정리 실행
6
- # .\scripts\cleanup-history.ps1 --entity=account # dry-run (특정 엔티티)
7
- # .\scripts\cleanup-history.ps1 --entity=account --apply
8
-
9
- param(
10
- [string]$Entity = "",
11
- [switch]$Apply
12
- )
13
-
14
- $ErrorActionPreference = "Stop"
15
-
16
- $ProjectRoot = Split-Path -Parent $PSScriptRoot
17
- Set-Location $ProjectRoot
18
-
19
- # LANGUAGE 로드
20
- $Lang = $env:LANGUAGE
21
- if (-not $Lang) {
22
- $EnvFile = Join-Path $ProjectRoot ".env"
23
- if (Test-Path $EnvFile) {
24
- $line = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -Last 1
25
- if ($line) { $Lang = $line -replace '^LANGUAGE=', '' }
26
- }
27
- }
28
- if (-not $Lang) { $Lang = "ko" }
29
-
30
- function Show-Help {
31
- if ($Lang -eq "en") {
32
- Write-Host "History TTL Cleanup"
33
- Write-Host "==================="
34
- Write-Host ""
35
- Write-Host "Usage: .\scripts\cleanup-history.ps1 [-Entity <name>] [-Apply]"
36
- Write-Host ""
37
- Write-Host "Options:"
38
- Write-Host " -Entity <name> Cleanup only one entity history"
39
- Write-Host " -Apply Execute delete (default: dry-run)"
40
- } else {
41
- Write-Host "히스토리 TTL 정리"
42
- Write-Host "================"
43
- Write-Host ""
44
- Write-Host "사용법: .\scripts\cleanup-history.ps1 [-Entity <이름>] [-Apply]"
45
- Write-Host ""
46
- Write-Host "옵션:"
47
- Write-Host " -Entity <이름> 특정 엔티티 히스토리만 정리"
48
- Write-Host " -Apply 실제 삭제 실행 (기본: dry-run)"
49
- }
50
- }
51
-
52
- # 인자 없으면 도움말
53
- if (-not $Apply -and -not $Entity) {
54
- Show-Help
55
- exit 0
56
- }
57
-
58
- $CliBin = Join-Path $ProjectRoot "entity-cli.exe"
59
- if (-not (Test-Path $CliBin)) {
60
- if ($Lang -eq "en") { Write-Error "❌ entity-cli.exe not found" }
61
- else { Write-Error "❌ entity-cli.exe 파일이 없습니다" }
62
- exit 1
63
- }
64
-
65
- $Args = @("cleanup-history")
66
- if ($Entity) { $Args += "--entity=$Entity" }
67
- if ($Apply) { $Args += "--apply" }
68
-
69
- & $CliBin @Args
1
+ # cleanup-history.ps1 — history_ttl 기준 이력 정리
2
+ #
3
+ # 사용법:
4
+ # .\scripts\cleanup-history.ps1 # 도움말
5
+ # .\scripts\cleanup-history.ps1 --apply # 전체 이력 정리 실행
6
+ # .\scripts\cleanup-history.ps1 --entity=account # dry-run (특정 엔티티)
7
+ # .\scripts\cleanup-history.ps1 --entity=account --apply
8
+
9
+ param(
10
+ [string]$Entity = "",
11
+ [switch]$Apply
12
+ )
13
+
14
+ $ErrorActionPreference = "Stop"
15
+
16
+ $ProjectRoot = Split-Path -Parent $PSScriptRoot
17
+ Set-Location $ProjectRoot
18
+
19
+ # LANGUAGE 로드
20
+ $Lang = $env:LANGUAGE
21
+ if (-not $Lang) {
22
+ $EnvFile = Join-Path $ProjectRoot ".env"
23
+ if (Test-Path $EnvFile) {
24
+ $line = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -Last 1
25
+ if ($line) { $Lang = $line -replace '^LANGUAGE=', '' }
26
+ }
27
+ }
28
+ if (-not $Lang) { $Lang = "ko" }
29
+
30
+ function Show-Help {
31
+ if ($Lang -eq "en") {
32
+ Write-Host "History TTL Cleanup"
33
+ Write-Host "==================="
34
+ Write-Host ""
35
+ Write-Host "Usage: .\scripts\cleanup-history.ps1 [-Entity <name>] [-Apply]"
36
+ Write-Host ""
37
+ Write-Host "Options:"
38
+ Write-Host " -Entity <name> Cleanup only one entity history"
39
+ Write-Host " -Apply Execute delete (default: dry-run)"
40
+ } else {
41
+ Write-Host "히스토리 TTL 정리"
42
+ Write-Host "================"
43
+ Write-Host ""
44
+ Write-Host "사용법: .\scripts\cleanup-history.ps1 [-Entity <이름>] [-Apply]"
45
+ Write-Host ""
46
+ Write-Host "옵션:"
47
+ Write-Host " -Entity <이름> 특정 엔티티 히스토리만 정리"
48
+ Write-Host " -Apply 실제 삭제 실행 (기본: dry-run)"
49
+ }
50
+ }
51
+
52
+ # 인자 없으면 도움말
53
+ if (-not $Apply -and -not $Entity) {
54
+ Show-Help
55
+ exit 0
56
+ }
57
+
58
+ $CliBin = Join-Path $ProjectRoot "entity-cli.exe"
59
+ if (-not (Test-Path $CliBin)) {
60
+ if ($Lang -eq "en") { Write-Error "❌ entity-cli.exe not found" }
61
+ else { Write-Error "❌ entity-cli.exe 파일이 없습니다" }
62
+ exit 1
63
+ }
64
+
65
+ $Args = @("cleanup-history")
66
+ if ($Entity) { $Args += "--entity=$Entity" }
67
+ if ($Apply) { $Args += "--apply" }
68
+
69
+ & $CliBin @Args
@@ -1,24 +1,24 @@
1
- # Entity CLI wrapper script (Windows PowerShell)
2
-
3
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
4
- $ProjectRoot = Split-Path -Parent $ScriptDir
5
- $BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
6
-
7
- # Load language from .env
8
- $Language = "ko"
9
- $EnvFile = Join-Path $ProjectRoot ".env"
10
- if (Test-Path $EnvFile) {
11
- $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
12
- if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
13
- }
14
-
15
- # Require prebuilt CLI binary
16
- if (-not (Test-Path $BinPath)) {
17
- if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
18
- else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
19
- exit 1
20
- }
21
-
22
- Set-Location $ProjectRoot
23
- $env:ENTITY_CLI_NAME = "cli"
24
- & $BinPath @args
1
+ # Entity CLI wrapper script (Windows PowerShell)
2
+
3
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
4
+ $ProjectRoot = Split-Path -Parent $ScriptDir
5
+ $BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
6
+
7
+ # Load language from .env
8
+ $Language = "ko"
9
+ $EnvFile = Join-Path $ProjectRoot ".env"
10
+ if (Test-Path $EnvFile) {
11
+ $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
12
+ if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
13
+ }
14
+
15
+ # Require prebuilt CLI binary
16
+ if (-not (Test-Path $BinPath)) {
17
+ if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
18
+ else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
19
+ exit 1
20
+ }
21
+
22
+ Set-Location $ProjectRoot
23
+ $env:ENTITY_CLI_NAME = "cli"
24
+ & $BinPath @args
@@ -1,70 +1,70 @@
1
- # Init Entity Tables - Windows PowerShell
2
- # Add, reset, or truncate one entity's data/index/history tables
3
-
4
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
5
- $ProjectRoot = Split-Path -Parent $ScriptDir
6
-
7
- Set-Location $ProjectRoot
8
-
9
- # Load language from .env
10
- $Language = "ko"
11
- $EnvFile = Join-Path $ProjectRoot ".env"
12
- if (Test-Path $EnvFile) {
13
- $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
14
- if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
15
- }
16
-
17
- function Show-Help {
18
- if ($Language -eq "en") {
19
- Write-Host "Init Entity Tables"
20
- Write-Host "=================="
21
- Write-Host ""
22
- Write-Host "Add, reset, or truncate one entity's data/index/history tables."
23
- Write-Host ""
24
- Write-Host "Usage: .\entity.ps1 --entity=<name> [--reset|--truncate] [--apply]"
25
- Write-Host ""
26
- Write-Host "Options:"
27
- Write-Host " --entity=<name> Entity name (required)"
28
- Write-Host " --reset Drop this entity tables and recreate"
29
- Write-Host " --truncate Delete all rows and reset AUTO_INCREMENT=1"
30
- Write-Host " --apply Execute (default is dry-run)"
31
- Write-Host ""
32
- Write-Host "Examples:"
33
- Write-Host " .\entity.ps1 --entity=license --apply"
34
- Write-Host " .\entity.ps1 --entity=account --reset --apply"
35
- Write-Host " .\entity.ps1 --entity=account --truncate --apply"
36
- } else {
37
- Write-Host "단일 엔티티 테이블 초기화"
38
- Write-Host "====================="
39
- Write-Host ""
40
- Write-Host "하나의 엔티티(data/index/history) 테이블을 추가/재생성/비우기(truncate) 합니다."
41
- Write-Host ""
42
- Write-Host "사용법: .\entity.ps1 --entity=<name> [--reset|--truncate] [--apply]"
43
- Write-Host ""
44
- Write-Host "옵션:"
45
- Write-Host " --entity=<name> 엔티티명 (필수)"
46
- Write-Host " --reset 해당 엔티티 테이블 드롭 후 재생성"
47
- Write-Host " --truncate 데이터 전체 삭제 + AUTO_INCREMENT=1 초기화"
48
- Write-Host " --apply 실제 실행 (기본은 dry-run)"
49
- Write-Host ""
50
- Write-Host "예제:"
51
- Write-Host " .\entity.ps1 --entity=license --apply"
52
- Write-Host " .\entity.ps1 --entity=account --reset --apply"
53
- Write-Host " .\entity.ps1 --entity=account --truncate --apply"
54
- }
55
- }
56
-
57
- if ($args.Count -eq 0) {
58
- Show-Help
59
- exit 0
60
- }
61
-
62
- $CliBin = Join-Path $ProjectRoot "bin\entity-cli.exe"
63
- if (-not (Test-Path $CliBin)) {
64
- if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
65
- else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
66
- exit 1
67
- }
68
-
69
- # Pass-through to CLI
70
- & $CliBin init-entity @args
1
+ # Init Entity Tables - Windows PowerShell
2
+ # Add, reset, or truncate one entity's data/index/history tables
3
+
4
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
5
+ $ProjectRoot = Split-Path -Parent $ScriptDir
6
+
7
+ Set-Location $ProjectRoot
8
+
9
+ # Load language from .env
10
+ $Language = "ko"
11
+ $EnvFile = Join-Path $ProjectRoot ".env"
12
+ if (Test-Path $EnvFile) {
13
+ $LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
14
+ if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
15
+ }
16
+
17
+ function Show-Help {
18
+ if ($Language -eq "en") {
19
+ Write-Host "Init Entity Tables"
20
+ Write-Host "=================="
21
+ Write-Host ""
22
+ Write-Host "Add, reset, or truncate one entity's data/index/history tables."
23
+ Write-Host ""
24
+ Write-Host "Usage: .\entity.ps1 --entity=<name> [--reset|--truncate] [--apply]"
25
+ Write-Host ""
26
+ Write-Host "Options:"
27
+ Write-Host " --entity=<name> Entity name (required)"
28
+ Write-Host " --reset Drop this entity tables and recreate"
29
+ Write-Host " --truncate Delete all rows and reset AUTO_INCREMENT=1"
30
+ Write-Host " --apply Execute (default is dry-run)"
31
+ Write-Host ""
32
+ Write-Host "Examples:"
33
+ Write-Host " .\entity.ps1 --entity=license --apply"
34
+ Write-Host " .\entity.ps1 --entity=account --reset --apply"
35
+ Write-Host " .\entity.ps1 --entity=account --truncate --apply"
36
+ } else {
37
+ Write-Host "단일 엔티티 테이블 초기화"
38
+ Write-Host "====================="
39
+ Write-Host ""
40
+ Write-Host "하나의 엔티티(data/index/history) 테이블을 추가/재생성/비우기(truncate) 합니다."
41
+ Write-Host ""
42
+ Write-Host "사용법: .\entity.ps1 --entity=<name> [--reset|--truncate] [--apply]"
43
+ Write-Host ""
44
+ Write-Host "옵션:"
45
+ Write-Host " --entity=<name> 엔티티명 (필수)"
46
+ Write-Host " --reset 해당 엔티티 테이블 드롭 후 재생성"
47
+ Write-Host " --truncate 데이터 전체 삭제 + AUTO_INCREMENT=1 초기화"
48
+ Write-Host " --apply 실제 실행 (기본은 dry-run)"
49
+ Write-Host ""
50
+ Write-Host "예제:"
51
+ Write-Host " .\entity.ps1 --entity=license --apply"
52
+ Write-Host " .\entity.ps1 --entity=account --reset --apply"
53
+ Write-Host " .\entity.ps1 --entity=account --truncate --apply"
54
+ }
55
+ }
56
+
57
+ if ($args.Count -eq 0) {
58
+ Show-Help
59
+ exit 0
60
+ }
61
+
62
+ $CliBin = Join-Path $ProjectRoot "bin\entity-cli.exe"
63
+ if (-not (Test-Path $CliBin)) {
64
+ if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
65
+ else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
66
+ exit 1
67
+ }
68
+
69
+ # Pass-through to CLI
70
+ & $CliBin init-entity @args