forge-sql-orm 2.0.27 → 2.0.29
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/dist/ForgeSQLORM.js +51 -21
- package/dist/ForgeSQLORM.js.map +1 -1
- package/dist/ForgeSQLORM.mjs +51 -21
- package/dist/ForgeSQLORM.mjs.map +1 -1
- package/dist/core/ForgeSQLAnalyseOperations.d.ts.map +1 -1
- package/dist/utils/sqlUtils.d.ts +13 -6
- package/dist/utils/sqlUtils.d.ts.map +1 -1
- package/dist/webtriggers/dropMigrationWebTrigger.d.ts +5 -5
- package/dist/webtriggers/dropTablesMigrationWebTrigger.d.ts +26 -0
- package/dist/webtriggers/dropTablesMigrationWebTrigger.d.ts.map +1 -0
- package/dist/webtriggers/index.d.ts +1 -0
- package/dist/webtriggers/index.d.ts.map +1 -1
- package/package.json +16 -10
- package/src/core/ForgeSQLAnalyseOperations.ts +3 -2
- package/src/core/ForgeSQLQueryBuilder.ts +8 -8
- package/src/utils/sqlUtils.ts +40 -17
- package/src/webtriggers/dropMigrationWebTrigger.ts +6 -6
- package/src/webtriggers/dropTablesMigrationWebTrigger.ts +50 -0
- package/src/webtriggers/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgeSQLAnalyseOperations.d.ts","sourceRoot":"","sources":["../../src/core/ForgeSQLAnalyseOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAoB7D;;GAEG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,I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AAC,iBAAiB,EAAE,CAAC;IAKjF;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,EAAE;IA+B/C;;;;OAIG;IACH,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,mBAAmB;IA4C1D;;;;;;OAMG;IACH,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM;IAkC5E;;;OAGG;IAEG,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAS1D;;;;OAIG;IACH,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,4BAA4B;IAexF;;;;;;OAMG;IACG,wBAAwB,CAC5B,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,CAAC,EAAE,IAAI,EACf,MAAM,CAAC,EAAE,IAAI,GACZ,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAS1C;;;;;;OAMG;IACG,qBAAqB,CACzB,MAAM,EAAE,aAAa,EAAE,EACvB,QAAQ,CAAC,EAAE,IAAI,EACf,MAAM,CAAC,EAAE,IAAI,GACZ,OAAO,CAAC,4BAA4B,EAAE,CAAC;CAI3C"}
|
package/dist/utils/sqlUtils.d.ts
CHANGED
|
@@ -29,11 +29,11 @@ export interface MetadataInfo {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Parses a date string into a Date object using the specified format
|
|
32
|
-
* @param value - The date string to parse
|
|
32
|
+
* @param value - The date string to parse or Date
|
|
33
33
|
* @param format - The format to use for parsing
|
|
34
34
|
* @returns Date object
|
|
35
35
|
*/
|
|
36
|
-
export declare const parseDateTime: (value: string, format: string) => Date;
|
|
36
|
+
export declare const parseDateTime: (value: string | Date, format: string) => Date;
|
|
37
37
|
/**
|
|
38
38
|
* Gets primary keys from the schema.
|
|
39
39
|
* @template T - The type of the table schema
|
|
@@ -48,11 +48,18 @@ export declare function getPrimaryKeys<T extends AnyMySqlTable>(table: T): [stri
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function getTableMetadata(table: AnyMySqlTable): MetadataInfo;
|
|
50
50
|
/**
|
|
51
|
-
* Generates SQL statements
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
51
|
+
* Generates SQL statements for dropping tables and/or their sequences.
|
|
52
|
+
*
|
|
53
|
+
* @param tables - List of table names to generate DROP statements for.
|
|
54
|
+
* @param options - Configuration object:
|
|
55
|
+
* - sequence: whether to drop associated sequences (default: true)
|
|
56
|
+
* - table: whether to drop tables themselves (default: true)
|
|
57
|
+
* @returns Array of SQL statements for dropping the specified objects
|
|
54
58
|
*/
|
|
55
|
-
export declare function generateDropTableStatements(tables: string[]
|
|
59
|
+
export declare function generateDropTableStatements(tables: string[], options?: {
|
|
60
|
+
sequence: boolean;
|
|
61
|
+
table: boolean;
|
|
62
|
+
}): string[];
|
|
56
63
|
type AliasColumnMap = Record<string, AnyColumn>;
|
|
57
64
|
export declare function mapSelectAllFieldsToAlias(selections: any, name: string, uniqName: string, fields: any, aliasMap: AliasColumnMap): any;
|
|
58
65
|
export declare function mapSelectFieldsWithAlias<TSelection extends SelectedFields>(fields: TSelection): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/sqlUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/sqlUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0C,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAqB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;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hD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,GAAG,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,cAAc,GACvB,GAAG,CAmBL;AACD,wBAAgB,wBAAwB,CAAC,UAAU,SAAS,cAAc,EACxE,MAAM,EAAE,UAAU,GACjB;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,CAUtD;AAsED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,UAAU,EACpD,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAClC,CAAC,EAAE,CAUL;AAoCD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED,wBAAgB,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -2,24 +2,24 @@ import { TriggerResponse } from "./index";
|
|
|
2
2
|
/**
|
|
3
3
|
* ⚠️ DEVELOPMENT ONLY WEB TRIGGER ⚠️
|
|
4
4
|
*
|
|
5
|
-
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables.
|
|
6
|
-
* It generates and executes SQL statements to drop tables
|
|
5
|
+
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables and sequences.
|
|
6
|
+
* It generates and executes SQL statements to drop tables, their associated constraints, and sequences.
|
|
7
7
|
*
|
|
8
8
|
* @warning This trigger should NEVER be used in production environments because:
|
|
9
|
-
* - It permanently deletes all data in the specified tables
|
|
9
|
+
* - It permanently deletes all data in the specified tables and sequences
|
|
10
10
|
* - The operation cannot be undone
|
|
11
11
|
* - It may affect application functionality
|
|
12
12
|
* - It could lead to data loss and system instability
|
|
13
13
|
*
|
|
14
14
|
* @returns {Promise<TriggerResponse<string>>} A response containing:
|
|
15
|
-
* - On success: 200 status with warning message about permanent deletion
|
|
15
|
+
* - On success: 200 status with warning message about permanent deletion of tables and sequences
|
|
16
16
|
* - On failure: 500 status with error message
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
20
|
* // Example usage in development only
|
|
21
21
|
* await dropSchemaMigrations();
|
|
22
|
-
* // ⚠️ Warning: This will permanently delete all data in users and orders tables
|
|
22
|
+
* // ⚠️ Warning: This will permanently delete all data in users and orders tables and their sequences
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export declare function dropSchemaMigrations(): Promise<TriggerResponse<string>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TriggerResponse } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* ⚠️ DEVELOPMENT ONLY WEB TRIGGER ⚠️
|
|
4
|
+
*
|
|
5
|
+
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables.
|
|
6
|
+
* It generates and executes SQL statements to drop tables and their associated constraints.
|
|
7
|
+
*
|
|
8
|
+
* @warning This trigger should NEVER be used in production environments because:
|
|
9
|
+
* - It permanently deletes all data in the specified tables
|
|
10
|
+
* - The operation cannot be undone
|
|
11
|
+
* - It may affect application functionality
|
|
12
|
+
* - It could lead to data loss and system instability
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<TriggerResponse<string>>} A response containing:
|
|
15
|
+
* - On success: 200 status with warning message about permanent deletion
|
|
16
|
+
* - On failure: 500 status with error message
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Example usage in development only
|
|
21
|
+
* await dropTableSchemaMigrations();
|
|
22
|
+
* // ⚠️ Warning: This will permanently delete all data in users and orders tables
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function dropTableSchemaMigrations(): Promise<TriggerResponse<string>>;
|
|
26
|
+
//# sourceMappingURL=dropTablesMigrationWebTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropTablesMigrationWebTrigger.d.ts","sourceRoot":"","sources":["../../src/webtriggers/dropTablesMigrationWebTrigger.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAAE,MAAM,SAAS,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAqBlF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./dropMigrationWebTrigger";
|
|
2
2
|
export * from "./applyMigrationsWebTrigger";
|
|
3
3
|
export * from "./fetchSchemaWebTrigger";
|
|
4
|
+
export * from "./dropTablesMigrationWebTrigger";
|
|
4
5
|
export interface TriggerResponse<BODY> {
|
|
5
6
|
body?: BODY;
|
|
6
7
|
headers?: Record<string, string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webtriggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webtriggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAEhD,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,GAAI,IAAI,EAAE,YAAY,MAAM,EAAE,MAAM,IAAI,KAAG,eAAe,CAAC,IAAI,CAc1F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forge-sql-orm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.29",
|
|
4
4
|
"description": "Drizzle ORM integration for Forge-SQL in Atlassian Forge applications.",
|
|
5
5
|
"main": "dist/ForgeSQLORM.js",
|
|
6
6
|
"module": "dist/ForgeSQLORM.mjs",
|
|
@@ -32,20 +32,23 @@
|
|
|
32
32
|
"database"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@eslint/js": "^9.
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
35
|
+
"@eslint/js": "^9.34.0",
|
|
36
|
+
"@types/luxon": "^3.7.1",
|
|
37
|
+
"@types/node": "^24.3.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.41.0",
|
|
38
40
|
"@vitest/coverage-v8": "^3.2.4",
|
|
39
41
|
"@vitest/ui": "^3.2.4",
|
|
40
|
-
"eslint": "^9.
|
|
42
|
+
"eslint": "^9.34.0",
|
|
41
43
|
"eslint-config-prettier": "^10.1.8",
|
|
42
44
|
"eslint-plugin-import": "^2.32.0",
|
|
43
45
|
"eslint-plugin-vitest": "^0.5.4",
|
|
46
|
+
"knip": "^5.63.0",
|
|
44
47
|
"prettier": "^3.6.2",
|
|
45
48
|
"ts-node": "^10.9.2",
|
|
46
49
|
"typescript": "^5.9.2",
|
|
47
50
|
"uuid": "^11.1.0",
|
|
48
|
-
"vite": "^7.1.
|
|
51
|
+
"vite": "^7.1.3",
|
|
49
52
|
"vitest": "^3.2.4"
|
|
50
53
|
},
|
|
51
54
|
"license": "MIT",
|
|
@@ -62,7 +65,8 @@
|
|
|
62
65
|
"build:types": "tsc --emitDeclarationOnly",
|
|
63
66
|
"prepublish:npm": "npm run build",
|
|
64
67
|
"publish:npm": "npm publish --access public",
|
|
65
|
-
"generate:models": "ts-node scripts/generate-models.ts"
|
|
68
|
+
"generate:models": "ts-node scripts/generate-models.ts",
|
|
69
|
+
"knip": "knip"
|
|
66
70
|
},
|
|
67
71
|
"files": [
|
|
68
72
|
"dist",
|
|
@@ -71,8 +75,10 @@
|
|
|
71
75
|
"README.md"
|
|
72
76
|
],
|
|
73
77
|
"peerDependencies": {
|
|
74
|
-
"@forge/sql": "^3.0.
|
|
75
|
-
"drizzle-orm": "^0.44.
|
|
76
|
-
|
|
78
|
+
"@forge/sql": "^3.0.5",
|
|
79
|
+
"drizzle-orm": "^0.44.5"
|
|
80
|
+
},
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"luxon": "^3.7.1"
|
|
77
83
|
}
|
|
78
84
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { SqlParameters } from "@forge/sql/out/sql-statement";
|
|
9
9
|
import { AnyMySqlTable } from "drizzle-orm/mysql-core/index";
|
|
10
10
|
import { getTableName } from "drizzle-orm/table";
|
|
11
|
-
import
|
|
11
|
+
import { DateTime } from "luxon";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Interface representing a row from the EXPLAIN ANALYZE output
|
|
@@ -358,7 +358,8 @@ export class ForgeSQLAnalyseOperation implements SchemaAnalyzeForgeSql {
|
|
|
358
358
|
* @returns {string} The SQL query for cluster statement history
|
|
359
359
|
*/
|
|
360
360
|
buildClusterStatementQuery(tables: string[], from?: Date, to?: Date): string {
|
|
361
|
-
const formatDateTime = (date: Date): string =>
|
|
361
|
+
const formatDateTime = (date: Date): string =>
|
|
362
|
+
DateTime.fromJSDate(date).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
|
|
362
363
|
|
|
363
364
|
const tableConditions = tables
|
|
364
365
|
.map((table) => `TABLE_NAMES LIKE CONCAT(SCHEMA_NAME, '.', '%', '${table}', '%')`)
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type SelectedFields,
|
|
12
12
|
} from "drizzle-orm/mysql-core/query-builders/select.types";
|
|
13
13
|
import { InferInsertModel, Query, SQL } from "drizzle-orm";
|
|
14
|
-
import
|
|
14
|
+
import { DateTime } from "luxon";
|
|
15
15
|
import { parseDateTime } from "../utils/sqlUtils";
|
|
16
16
|
import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT } from "drizzle-orm/mysql-proxy/index";
|
|
17
17
|
import { SqlHints } from "../utils/sqlHints";
|
|
@@ -371,10 +371,10 @@ export const forgeDateTimeString = customType<{
|
|
|
371
371
|
return "datetime";
|
|
372
372
|
},
|
|
373
373
|
toDriver(value: Date) {
|
|
374
|
-
return
|
|
374
|
+
return DateTime.fromJSDate(value).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
|
|
375
375
|
},
|
|
376
376
|
fromDriver(value: unknown) {
|
|
377
|
-
const format = "
|
|
377
|
+
const format = "yyyy-LL-dd'T'HH:mm:ss.SSS";
|
|
378
378
|
return parseDateTime(value as string, format);
|
|
379
379
|
},
|
|
380
380
|
});
|
|
@@ -394,10 +394,10 @@ export const forgeTimestampString = customType<{
|
|
|
394
394
|
return "timestamp";
|
|
395
395
|
},
|
|
396
396
|
toDriver(value: Date) {
|
|
397
|
-
return
|
|
397
|
+
return DateTime.fromJSDate(value).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
|
|
398
398
|
},
|
|
399
399
|
fromDriver(value: unknown) {
|
|
400
|
-
const format = "
|
|
400
|
+
const format = "yyyy-LL-dd'T'HH:mm:ss.SSS";
|
|
401
401
|
return parseDateTime(value as string, format);
|
|
402
402
|
},
|
|
403
403
|
});
|
|
@@ -417,10 +417,10 @@ export const forgeDateString = customType<{
|
|
|
417
417
|
return "date";
|
|
418
418
|
},
|
|
419
419
|
toDriver(value: Date) {
|
|
420
|
-
return
|
|
420
|
+
return DateTime.fromJSDate(value).toFormat("yyyy-LL-dd");
|
|
421
421
|
},
|
|
422
422
|
fromDriver(value: unknown) {
|
|
423
|
-
const format = "
|
|
423
|
+
const format = "yyyy-LL-dd";
|
|
424
424
|
return parseDateTime(value as string, format);
|
|
425
425
|
},
|
|
426
426
|
});
|
|
@@ -440,7 +440,7 @@ export const forgeTimeString = customType<{
|
|
|
440
440
|
return "time";
|
|
441
441
|
},
|
|
442
442
|
toDriver(value: Date) {
|
|
443
|
-
return
|
|
443
|
+
return DateTime.fromJSDate(value).toFormat("HH:mm:ss.SSS");
|
|
444
444
|
},
|
|
445
445
|
fromDriver(value: unknown) {
|
|
446
446
|
return parseDateTime(value as string, "HH:mm:ss.SSS");
|
package/src/utils/sqlUtils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import moment from "moment";
|
|
2
1
|
import { AnyColumn, Column, isTable, SQL, sql, StringChunk } from "drizzle-orm";
|
|
3
2
|
import { AnyMySqlTable, MySqlCustomColumn } from "drizzle-orm/mysql-core/index";
|
|
3
|
+
import { DateTime } from "luxon";
|
|
4
4
|
import { PrimaryKeyBuilder } from "drizzle-orm/mysql-core/primary-keys";
|
|
5
5
|
import { AnyIndexBuilder } from "drizzle-orm/mysql-core/indexes";
|
|
6
6
|
import { CheckBuilder } from "drizzle-orm/mysql-core/checks";
|
|
@@ -42,23 +42,31 @@ interface ConfigBuilderData {
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Parses a date string into a Date object using the specified format
|
|
45
|
-
* @param value - The date string to parse
|
|
45
|
+
* @param value - The date string to parse or Date
|
|
46
46
|
* @param format - The format to use for parsing
|
|
47
47
|
* @returns Date object
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
export const parseDateTime = (value: string | Date, format: string): Date => {
|
|
50
51
|
let result: Date;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
if (value instanceof Date) {
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
// 1. Try to parse using the provided format (strict mode)
|
|
56
|
+
const dt = DateTime.fromFormat(value, format);
|
|
57
|
+
if (dt.isValid) {
|
|
58
|
+
result = dt.toJSDate();
|
|
59
|
+
} else {
|
|
60
|
+
// 2. Try to parse as ISO string
|
|
61
|
+
const isoDt = DateTime.fromISO(value);
|
|
62
|
+
if (isoDt.isValid) {
|
|
63
|
+
result = isoDt.toJSDate();
|
|
56
64
|
} else {
|
|
65
|
+
// 3. Fallback: use native Date constructor
|
|
57
66
|
result = new Date(value);
|
|
58
67
|
}
|
|
59
|
-
} else {
|
|
60
|
-
result = m.toDate();
|
|
61
68
|
}
|
|
69
|
+
// 4. Ensure the result is a valid Date object
|
|
62
70
|
if (isNaN(result.getTime())) {
|
|
63
71
|
result = new Date(value);
|
|
64
72
|
}
|
|
@@ -239,16 +247,31 @@ export function getTableMetadata(table: AnyMySqlTable): MetadataInfo {
|
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
/**
|
|
242
|
-
* Generates SQL statements
|
|
243
|
-
*
|
|
244
|
-
* @
|
|
250
|
+
* Generates SQL statements for dropping tables and/or their sequences.
|
|
251
|
+
*
|
|
252
|
+
* @param tables - List of table names to generate DROP statements for.
|
|
253
|
+
* @param options - Configuration object:
|
|
254
|
+
* - sequence: whether to drop associated sequences (default: true)
|
|
255
|
+
* - table: whether to drop tables themselves (default: true)
|
|
256
|
+
* @returns Array of SQL statements for dropping the specified objects
|
|
245
257
|
*/
|
|
246
|
-
export function generateDropTableStatements(
|
|
258
|
+
export function generateDropTableStatements(
|
|
259
|
+
tables: string[],
|
|
260
|
+
options?: { sequence: boolean; table: boolean },
|
|
261
|
+
): string[] {
|
|
247
262
|
const dropStatements: string[] = [];
|
|
248
|
-
|
|
263
|
+
const validOptions = options ?? { sequence: true, table: true };
|
|
264
|
+
if (!validOptions.sequence && !validOptions.table) {
|
|
265
|
+
console.warn('No drop operations requested: both "table" and "sequence" options are false');
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
249
268
|
tables.forEach((tableName) => {
|
|
250
|
-
|
|
251
|
-
|
|
269
|
+
if (validOptions.table) {
|
|
270
|
+
dropStatements.push(`DROP TABLE IF EXISTS \`${tableName}\`;`);
|
|
271
|
+
}
|
|
272
|
+
if (validOptions.sequence) {
|
|
273
|
+
dropStatements.push(`DROP SEQUENCE IF EXISTS \`${tableName}\`;`);
|
|
274
|
+
}
|
|
252
275
|
});
|
|
253
276
|
|
|
254
277
|
return dropStatements;
|
|
@@ -6,31 +6,31 @@ import { getTables } from "../core/SystemTables";
|
|
|
6
6
|
/**
|
|
7
7
|
* ⚠️ DEVELOPMENT ONLY WEB TRIGGER ⚠️
|
|
8
8
|
*
|
|
9
|
-
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables.
|
|
10
|
-
* It generates and executes SQL statements to drop tables
|
|
9
|
+
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables and sequences.
|
|
10
|
+
* It generates and executes SQL statements to drop tables, their associated constraints, and sequences.
|
|
11
11
|
*
|
|
12
12
|
* @warning This trigger should NEVER be used in production environments because:
|
|
13
|
-
* - It permanently deletes all data in the specified tables
|
|
13
|
+
* - It permanently deletes all data in the specified tables and sequences
|
|
14
14
|
* - The operation cannot be undone
|
|
15
15
|
* - It may affect application functionality
|
|
16
16
|
* - It could lead to data loss and system instability
|
|
17
17
|
*
|
|
18
18
|
* @returns {Promise<TriggerResponse<string>>} A response containing:
|
|
19
|
-
* - On success: 200 status with warning message about permanent deletion
|
|
19
|
+
* - On success: 200 status with warning message about permanent deletion of tables and sequences
|
|
20
20
|
* - On failure: 500 status with error message
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
24
|
* // Example usage in development only
|
|
25
25
|
* await dropSchemaMigrations();
|
|
26
|
-
* // ⚠️ Warning: This will permanently delete all data in users and orders tables
|
|
26
|
+
* // ⚠️ Warning: This will permanently delete all data in users and orders tables and their sequences
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
export async function dropSchemaMigrations(): Promise<TriggerResponse<string>> {
|
|
30
30
|
try {
|
|
31
31
|
const tables = await getTables();
|
|
32
32
|
// Generate drop statements
|
|
33
|
-
const dropStatements = generateStatements(tables);
|
|
33
|
+
const dropStatements = generateStatements(tables, { sequence: true, table: true });
|
|
34
34
|
|
|
35
35
|
// Execute each statement
|
|
36
36
|
for (const statement of dropStatements) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { sql } from "@forge/sql";
|
|
2
|
+
import { generateDropTableStatements as generateStatements } from "../utils/sqlUtils";
|
|
3
|
+
import { getHttpResponse, TriggerResponse } from "./index";
|
|
4
|
+
import { getTables } from "../core/SystemTables";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ⚠️ DEVELOPMENT ONLY WEB TRIGGER ⚠️
|
|
8
|
+
*
|
|
9
|
+
* This web trigger is designed for development environments only and will permanently delete all data in the specified tables.
|
|
10
|
+
* It generates and executes SQL statements to drop tables and their associated constraints.
|
|
11
|
+
*
|
|
12
|
+
* @warning This trigger should NEVER be used in production environments because:
|
|
13
|
+
* - It permanently deletes all data in the specified tables
|
|
14
|
+
* - The operation cannot be undone
|
|
15
|
+
* - It may affect application functionality
|
|
16
|
+
* - It could lead to data loss and system instability
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<TriggerResponse<string>>} A response containing:
|
|
19
|
+
* - On success: 200 status with warning message about permanent deletion
|
|
20
|
+
* - On failure: 500 status with error message
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Example usage in development only
|
|
25
|
+
* await dropTableSchemaMigrations();
|
|
26
|
+
* // ⚠️ Warning: This will permanently delete all data in users and orders tables
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export async function dropTableSchemaMigrations(): Promise<TriggerResponse<string>> {
|
|
30
|
+
try {
|
|
31
|
+
const tables = await getTables();
|
|
32
|
+
// Generate drop statements
|
|
33
|
+
const dropStatements = generateStatements(tables, { sequence: false, table: true });
|
|
34
|
+
|
|
35
|
+
// Execute each statement
|
|
36
|
+
for (const statement of dropStatements) {
|
|
37
|
+
console.warn(statement);
|
|
38
|
+
await sql.executeDDL(statement);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return getHttpResponse<string>(
|
|
42
|
+
200,
|
|
43
|
+
"⚠️ All data in these tables has been permanently deleted. This operation cannot be undone.",
|
|
44
|
+
);
|
|
45
|
+
} catch (error: unknown) {
|
|
46
|
+
console.error(error);
|
|
47
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
48
|
+
return getHttpResponse<string>(500, errorMessage);
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/webtriggers/index.ts
CHANGED