schema-seed-adapter-oracle 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 schema-seed contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @schema-seed/adapter-oracle
2
+
3
+ Part of the [schema-seed](https://github.com/AliNazar-111/schema-seed) project.
4
+
5
+ For full documentation and usage, please visit the [main repository](https://github.com/AliNazar-111/schema-seed).
package/dist/index.cjs ADDED
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ OracleAdapter: () => OracleAdapter,
34
+ createOracleAdapter: () => createOracleAdapter
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_oracledb = __toESM(require("oracledb"), 1);
38
+ var import_schema_seed_core = require("schema-seed-core");
39
+ var OracleAdapter = class {
40
+ connection = null;
41
+ config;
42
+ constructor(config) {
43
+ this.config = config;
44
+ }
45
+ async connect() {
46
+ this.connection = await import_oracledb.default.getConnection(this.config);
47
+ }
48
+ async disconnect() {
49
+ if (this.connection) {
50
+ await this.connection.close();
51
+ this.connection = null;
52
+ }
53
+ }
54
+ async begin() {
55
+ }
56
+ async commit() {
57
+ await this.connection?.commit();
58
+ }
59
+ async rollback() {
60
+ await this.connection?.rollback();
61
+ }
62
+ async introspectSchema() {
63
+ if (!this.connection) throw new Error("Not connected");
64
+ const schema = { tables: {} };
65
+ const user = this.config.user?.toUpperCase();
66
+ const tablesRes = await this.connection.execute(
67
+ `SELECT table_name, owner FROM all_tables WHERE owner = :owner`,
68
+ { owner: user },
69
+ { outFormat: import_oracledb.default.OUT_FORMAT_OBJECT }
70
+ );
71
+ for (const row of tablesRes.rows || []) {
72
+ const tableName = row.TABLE_NAME;
73
+ schema.tables[tableName] = {
74
+ name: tableName,
75
+ schema: row.OWNER,
76
+ columns: {},
77
+ foreignKeys: [],
78
+ uniqueConstraints: []
79
+ };
80
+ }
81
+ const columnsRes = await this.connection.execute(
82
+ `SELECT table_name, column_name, data_type, nullable, data_default, identity_column
83
+ FROM all_tab_columns
84
+ WHERE owner = :owner`,
85
+ { owner: user },
86
+ { outFormat: import_oracledb.default.OUT_FORMAT_OBJECT }
87
+ );
88
+ for (const row of columnsRes.rows || []) {
89
+ if (!schema.tables[row.TABLE_NAME]) continue;
90
+ const col = {
91
+ name: row.COLUMN_NAME,
92
+ type: this.mapOracleType(row.DATA_TYPE),
93
+ rawType: row.DATA_TYPE,
94
+ nullable: row.NULLABLE === "Y",
95
+ defaultValue: row.DATA_DEFAULT,
96
+ isAutoIncrement: row.IDENTITY_COLUMN === "YES"
97
+ };
98
+ schema.tables[row.TABLE_NAME].columns[row.COLUMN_NAME] = col;
99
+ }
100
+ const constraintsRes = await this.connection.execute(
101
+ `SELECT c.table_name, c.constraint_name, c.constraint_type, col.column_name, c.r_owner, c.r_constraint_name
102
+ FROM all_constraints c
103
+ JOIN all_cons_columns col ON c.owner = col.owner AND c.constraint_name = col.constraint_name
104
+ WHERE c.owner = :owner AND c.constraint_type IN ('P', 'R', 'U')`,
105
+ { owner: user },
106
+ { outFormat: import_oracledb.default.OUT_FORMAT_OBJECT }
107
+ );
108
+ for (const row of constraintsRes.rows || []) {
109
+ const table = schema.tables[row.TABLE_NAME];
110
+ if (!table) continue;
111
+ if (row.CONSTRAINT_TYPE === "P") {
112
+ if (!table.primaryKey) table.primaryKey = { columns: [] };
113
+ table.primaryKey.columns.push(row.COLUMN_NAME);
114
+ } else if (row.CONSTRAINT_TYPE === "U") {
115
+ let constraint = table.uniqueConstraints.find((uc) => uc.name === row.CONSTRAINT_NAME);
116
+ if (!constraint) {
117
+ constraint = { name: row.CONSTRAINT_NAME, columns: [] };
118
+ table.uniqueConstraints.push(constraint);
119
+ }
120
+ constraint.columns.push(row.COLUMN_NAME);
121
+ } else if (row.CONSTRAINT_TYPE === "R") {
122
+ const refRes = await this.connection.execute(
123
+ `SELECT table_name, column_name FROM all_cons_columns WHERE owner = :owner AND constraint_name = :cname`,
124
+ { owner: row.R_OWNER, cname: row.R_CONSTRAINT_NAME },
125
+ { outFormat: import_oracledb.default.OUT_FORMAT_OBJECT }
126
+ );
127
+ if (refRes.rows && refRes.rows.length > 0) {
128
+ table.foreignKeys.push({
129
+ name: row.CONSTRAINT_NAME,
130
+ columns: [row.COLUMN_NAME],
131
+ referencedTable: refRes.rows[0].TABLE_NAME,
132
+ referencedColumns: [refRes.rows[0].COLUMN_NAME]
133
+ });
134
+ }
135
+ }
136
+ }
137
+ return schema;
138
+ }
139
+ async insertBatch(batch) {
140
+ if (!this.connection) throw new Error("Not connected");
141
+ const { tableName, rows } = batch;
142
+ if (rows.length === 0) return;
143
+ const columns = Object.keys(rows[0]);
144
+ const bindDefs = {};
145
+ for (const col of columns) {
146
+ bindDefs[col] = { type: import_oracledb.default.STRING, maxSize: 4e3 };
147
+ }
148
+ const query = `INSERT INTO "${tableName}" (${columns.map((c) => `"${c}"`).join(", ")}) VALUES (${columns.map((c) => `:${c}`).join(", ")})`;
149
+ await this.connection.executeMany(query, rows, {
150
+ autoCommit: false,
151
+ bindDefs
152
+ });
153
+ }
154
+ async truncateTables(tableNames) {
155
+ if (!this.connection) throw new Error("Not connected");
156
+ for (const table of tableNames) {
157
+ try {
158
+ await this.connection.execute(`TRUNCATE TABLE "${table}"`);
159
+ } catch (err) {
160
+ await this.connection.execute(`DELETE FROM "${table}"`);
161
+ }
162
+ }
163
+ }
164
+ capabilities = {
165
+ enums: false,
166
+ deferrableConstraints: true,
167
+ returning: true,
168
+ identityInsert: true
169
+ };
170
+ mapOracleType(oracleType) {
171
+ const type = oracleType.toUpperCase();
172
+ if (type.includes("NUMBER")) return import_schema_seed_core.NormalizedSqlType.DECIMAL;
173
+ if (type.includes("INTEGER") || type.includes("INT")) return import_schema_seed_core.NormalizedSqlType.INT;
174
+ if (type.includes("CHAR") || type.includes("CLOB")) return import_schema_seed_core.NormalizedSqlType.STRING;
175
+ if (type.includes("DATE") || type.includes("TIMESTAMP")) return import_schema_seed_core.NormalizedSqlType.DATETIME;
176
+ if (type.includes("RAW")) return import_schema_seed_core.NormalizedSqlType.BINARY;
177
+ if (type.includes("BLOB")) return import_schema_seed_core.NormalizedSqlType.BINARY;
178
+ return import_schema_seed_core.NormalizedSqlType.STRING;
179
+ }
180
+ };
181
+ function createOracleAdapter(config) {
182
+ return new OracleAdapter(config);
183
+ }
184
+ // Annotate the CommonJS export names for ESM import in node:
185
+ 0 && (module.exports = {
186
+ OracleAdapter,
187
+ createOracleAdapter
188
+ });
189
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import oracledb from 'oracledb'\nimport {\n SqlAdapter,\n SchemaGraph,\n SeedBatch,\n NormalizedSqlType,\n TableSchema,\n ColumnSchema\n} from 'schema-seed-core'\n\nexport class OracleAdapter implements SqlAdapter {\n private connection: oracledb.Connection | null = null\n private config: oracledb.ConnectionAttributes\n\n constructor(config: oracledb.ConnectionAttributes) {\n this.config = config\n }\n\n async connect(): Promise<void> {\n this.connection = await oracledb.getConnection(this.config)\n }\n\n async disconnect(): Promise<void> {\n if (this.connection) {\n await this.connection.close()\n this.connection = null\n }\n }\n\n async begin(): Promise<void> {\n // Oracle doesn't have a specific BEGIN command like Postgres/MySQL\n // Transactions start automatically with the first DML statement.\n // We just need to ensure autoCommit is false (which it is by default).\n }\n\n async commit(): Promise<void> {\n await this.connection?.commit()\n }\n\n async rollback(): Promise<void> {\n await this.connection?.rollback()\n }\n\n async introspectSchema(): Promise<SchemaGraph> {\n if (!this.connection) throw new Error('Not connected')\n\n const schema: SchemaGraph = { tables: {} }\n const user = this.config.user?.toUpperCase()\n\n // Get tables\n const tablesRes = await this.connection.execute<{ TABLE_NAME: string, OWNER: string }>(\n `SELECT table_name, owner FROM all_tables WHERE owner = :owner`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (tablesRes.rows || [])) {\n const tableName = row.TABLE_NAME\n schema.tables[tableName] = {\n name: tableName,\n schema: row.OWNER,\n columns: {},\n foreignKeys: [],\n uniqueConstraints: []\n }\n }\n\n // Get columns\n const columnsRes = await this.connection.execute<{\n TABLE_NAME: string,\n COLUMN_NAME: string,\n DATA_TYPE: string,\n NULLABLE: string,\n DATA_DEFAULT: any,\n IDENTITY_COLUMN: string\n }>(\n `SELECT table_name, column_name, data_type, nullable, data_default, identity_column \n FROM all_tab_columns \n WHERE owner = :owner`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (columnsRes.rows || [])) {\n if (!schema.tables[row.TABLE_NAME]) continue\n\n const col: ColumnSchema = {\n name: row.COLUMN_NAME,\n type: this.mapOracleType(row.DATA_TYPE),\n rawType: row.DATA_TYPE,\n nullable: row.NULLABLE === 'Y',\n defaultValue: row.DATA_DEFAULT,\n isAutoIncrement: row.IDENTITY_COLUMN === 'YES'\n }\n schema.tables[row.TABLE_NAME].columns[row.COLUMN_NAME] = col\n }\n\n // Get Constraints (PK, FK, Unique)\n const constraintsRes = await this.connection.execute<{\n TABLE_NAME: string,\n CONSTRAINT_NAME: string,\n CONSTRAINT_TYPE: string,\n COLUMN_NAME: string,\n R_OWNER: string,\n R_CONSTRAINT_NAME: string\n }>(\n `SELECT c.table_name, c.constraint_name, c.constraint_type, col.column_name, c.r_owner, c.r_constraint_name\n FROM all_constraints c\n JOIN all_cons_columns col ON c.owner = col.owner AND c.constraint_name = col.constraint_name\n WHERE c.owner = :owner AND c.constraint_type IN ('P', 'R', 'U')`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (constraintsRes.rows || [])) {\n const table = schema.tables[row.TABLE_NAME]\n if (!table) continue\n\n if (row.CONSTRAINT_TYPE === 'P') {\n if (!table.primaryKey) table.primaryKey = { columns: [] }\n table.primaryKey.columns.push(row.COLUMN_NAME)\n } else if (row.CONSTRAINT_TYPE === 'U') {\n let constraint = table.uniqueConstraints.find(uc => uc.name === row.CONSTRAINT_NAME)\n if (!constraint) {\n constraint = { name: row.CONSTRAINT_NAME, columns: [] }\n table.uniqueConstraints.push(constraint)\n }\n constraint.columns.push(row.COLUMN_NAME)\n } else if (row.CONSTRAINT_TYPE === 'R') {\n // Foreign Key\n // We need to find the referenced table name from the referenced constraint\n const refRes = await this.connection.execute<{ TABLE_NAME: string, COLUMN_NAME: string }>(\n `SELECT table_name, column_name FROM all_cons_columns WHERE owner = :owner AND constraint_name = :cname`,\n { owner: row.R_OWNER, cname: row.R_CONSTRAINT_NAME },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n if (refRes.rows && refRes.rows.length > 0) {\n table.foreignKeys.push({\n name: row.CONSTRAINT_NAME,\n columns: [row.COLUMN_NAME],\n referencedTable: refRes.rows[0].TABLE_NAME,\n referencedColumns: [refRes.rows[0].COLUMN_NAME]\n })\n }\n }\n }\n\n return schema\n }\n\n async insertBatch(batch: SeedBatch): Promise<void> {\n if (!this.connection) throw new Error('Not connected')\n const { tableName, rows } = batch\n if (rows.length === 0) return\n\n const columns = Object.keys(rows[0])\n const bindDefs: Record<string, any> = {}\n\n // Oracle executeMany requires bindDefs for better performance and type safety\n for (const col of columns) {\n // We'll infer type from the first row or just use default\n bindDefs[col] = { type: oracledb.STRING, maxSize: 4000 } // Default to string for simplicity\n }\n\n const query = `INSERT INTO \"${tableName}\" (${columns.map(c => `\"${c}\"`).join(', ')}) VALUES (${columns.map(c => `:${c}`).join(', ')})`\n\n await this.connection.executeMany(query, rows, {\n autoCommit: false,\n bindDefs\n })\n }\n\n async truncateTables(tableNames: string[]): Promise<void> {\n if (!this.connection) throw new Error('Not connected')\n\n for (const table of tableNames) {\n try {\n await this.connection.execute(`TRUNCATE TABLE \"${table}\"`)\n } catch (err: any) {\n // Fallback to DELETE if TRUNCATE fails (e.g. due to FKs or permissions)\n await this.connection.execute(`DELETE FROM \"${table}\"`)\n }\n }\n }\n\n readonly capabilities = {\n enums: false,\n deferrableConstraints: true,\n returning: true,\n identityInsert: true\n }\n\n private mapOracleType(oracleType: string): NormalizedSqlType {\n const type = oracleType.toUpperCase()\n if (type.includes('NUMBER')) return NormalizedSqlType.DECIMAL\n if (type.includes('INTEGER') || type.includes('INT')) return NormalizedSqlType.INT\n if (type.includes('CHAR') || type.includes('CLOB')) return NormalizedSqlType.STRING\n if (type.includes('DATE') || type.includes('TIMESTAMP')) return NormalizedSqlType.DATETIME\n if (type.includes('RAW')) return NormalizedSqlType.BINARY\n if (type.includes('BLOB')) return NormalizedSqlType.BINARY\n\n return NormalizedSqlType.STRING\n }\n}\n\nexport function createOracleAdapter(config: oracledb.ConnectionAttributes): OracleAdapter {\n return new OracleAdapter(config)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AACrB,8BAOO;AAEA,IAAM,gBAAN,MAA0C;AAAA,EACvC,aAAyC;AAAA,EACzC;AAAA,EAER,YAAY,QAAuC;AACjD,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,UAAyB;AAC7B,SAAK,aAAa,MAAM,gBAAAA,QAAS,cAAc,KAAK,MAAM;AAAA,EAC5D;AAAA,EAEA,MAAM,aAA4B;AAChC,QAAI,KAAK,YAAY;AACnB,YAAM,KAAK,WAAW,MAAM;AAC5B,WAAK,aAAa;AAAA,IACpB;AAAA,EACF;AAAA,EA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C7E,QAAI,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,WAAW,EAAG,QAAO,0CAAkB;AAClF,QAAI,KAAK,SAAS,KAAK,EAAG,QAAO,0CAAkB;AACnD,QAAI,KAAK,SAAS,MAAM,EAAG,QAAO,0CAAkB;AAEpD,WAAO,0CAAkB;AAAA,EAC3B;AACF;AAEO,SAAS,oBAAoB,QAAsD;AACxF,SAAO,IAAI,cAAc,MAAM;AACjC;","names":["oracledb"]}
@@ -0,0 +1,26 @@
1
+ import oracledb from 'oracledb';
2
+ import { SqlAdapter, SchemaGraph, SeedBatch } from 'schema-seed-core';
3
+
4
+ declare class OracleAdapter implements SqlAdapter {
5
+ private connection;
6
+ private config;
7
+ constructor(config: oracledb.ConnectionAttributes);
8
+ connect(): Promise<void>;
9
+ disconnect(): Promise<void>;
10
+ begin(): Promise<void>;
11
+ commit(): Promise<void>;
12
+ rollback(): Promise<void>;
13
+ introspectSchema(): Promise<SchemaGraph>;
14
+ insertBatch(batch: SeedBatch): Promise<void>;
15
+ truncateTables(tableNames: string[]): Promise<void>;
16
+ readonly capabilities: {
17
+ enums: boolean;
18
+ deferrableConstraints: boolean;
19
+ returning: boolean;
20
+ identityInsert: boolean;
21
+ };
22
+ private mapOracleType;
23
+ }
24
+ declare function createOracleAdapter(config: oracledb.ConnectionAttributes): OracleAdapter;
25
+
26
+ export { OracleAdapter, createOracleAdapter };
@@ -0,0 +1,26 @@
1
+ import oracledb from 'oracledb';
2
+ import { SqlAdapter, SchemaGraph, SeedBatch } from 'schema-seed-core';
3
+
4
+ declare class OracleAdapter implements SqlAdapter {
5
+ private connection;
6
+ private config;
7
+ constructor(config: oracledb.ConnectionAttributes);
8
+ connect(): Promise<void>;
9
+ disconnect(): Promise<void>;
10
+ begin(): Promise<void>;
11
+ commit(): Promise<void>;
12
+ rollback(): Promise<void>;
13
+ introspectSchema(): Promise<SchemaGraph>;
14
+ insertBatch(batch: SeedBatch): Promise<void>;
15
+ truncateTables(tableNames: string[]): Promise<void>;
16
+ readonly capabilities: {
17
+ enums: boolean;
18
+ deferrableConstraints: boolean;
19
+ returning: boolean;
20
+ identityInsert: boolean;
21
+ };
22
+ private mapOracleType;
23
+ }
24
+ declare function createOracleAdapter(config: oracledb.ConnectionAttributes): OracleAdapter;
25
+
26
+ export { OracleAdapter, createOracleAdapter };
package/dist/index.js ADDED
@@ -0,0 +1,155 @@
1
+ // src/index.ts
2
+ import oracledb from "oracledb";
3
+ import {
4
+ NormalizedSqlType
5
+ } from "schema-seed-core";
6
+ var OracleAdapter = class {
7
+ connection = null;
8
+ config;
9
+ constructor(config) {
10
+ this.config = config;
11
+ }
12
+ async connect() {
13
+ this.connection = await oracledb.getConnection(this.config);
14
+ }
15
+ async disconnect() {
16
+ if (this.connection) {
17
+ await this.connection.close();
18
+ this.connection = null;
19
+ }
20
+ }
21
+ async begin() {
22
+ }
23
+ async commit() {
24
+ await this.connection?.commit();
25
+ }
26
+ async rollback() {
27
+ await this.connection?.rollback();
28
+ }
29
+ async introspectSchema() {
30
+ if (!this.connection) throw new Error("Not connected");
31
+ const schema = { tables: {} };
32
+ const user = this.config.user?.toUpperCase();
33
+ const tablesRes = await this.connection.execute(
34
+ `SELECT table_name, owner FROM all_tables WHERE owner = :owner`,
35
+ { owner: user },
36
+ { outFormat: oracledb.OUT_FORMAT_OBJECT }
37
+ );
38
+ for (const row of tablesRes.rows || []) {
39
+ const tableName = row.TABLE_NAME;
40
+ schema.tables[tableName] = {
41
+ name: tableName,
42
+ schema: row.OWNER,
43
+ columns: {},
44
+ foreignKeys: [],
45
+ uniqueConstraints: []
46
+ };
47
+ }
48
+ const columnsRes = await this.connection.execute(
49
+ `SELECT table_name, column_name, data_type, nullable, data_default, identity_column
50
+ FROM all_tab_columns
51
+ WHERE owner = :owner`,
52
+ { owner: user },
53
+ { outFormat: oracledb.OUT_FORMAT_OBJECT }
54
+ );
55
+ for (const row of columnsRes.rows || []) {
56
+ if (!schema.tables[row.TABLE_NAME]) continue;
57
+ const col = {
58
+ name: row.COLUMN_NAME,
59
+ type: this.mapOracleType(row.DATA_TYPE),
60
+ rawType: row.DATA_TYPE,
61
+ nullable: row.NULLABLE === "Y",
62
+ defaultValue: row.DATA_DEFAULT,
63
+ isAutoIncrement: row.IDENTITY_COLUMN === "YES"
64
+ };
65
+ schema.tables[row.TABLE_NAME].columns[row.COLUMN_NAME] = col;
66
+ }
67
+ const constraintsRes = await this.connection.execute(
68
+ `SELECT c.table_name, c.constraint_name, c.constraint_type, col.column_name, c.r_owner, c.r_constraint_name
69
+ FROM all_constraints c
70
+ JOIN all_cons_columns col ON c.owner = col.owner AND c.constraint_name = col.constraint_name
71
+ WHERE c.owner = :owner AND c.constraint_type IN ('P', 'R', 'U')`,
72
+ { owner: user },
73
+ { outFormat: oracledb.OUT_FORMAT_OBJECT }
74
+ );
75
+ for (const row of constraintsRes.rows || []) {
76
+ const table = schema.tables[row.TABLE_NAME];
77
+ if (!table) continue;
78
+ if (row.CONSTRAINT_TYPE === "P") {
79
+ if (!table.primaryKey) table.primaryKey = { columns: [] };
80
+ table.primaryKey.columns.push(row.COLUMN_NAME);
81
+ } else if (row.CONSTRAINT_TYPE === "U") {
82
+ let constraint = table.uniqueConstraints.find((uc) => uc.name === row.CONSTRAINT_NAME);
83
+ if (!constraint) {
84
+ constraint = { name: row.CONSTRAINT_NAME, columns: [] };
85
+ table.uniqueConstraints.push(constraint);
86
+ }
87
+ constraint.columns.push(row.COLUMN_NAME);
88
+ } else if (row.CONSTRAINT_TYPE === "R") {
89
+ const refRes = await this.connection.execute(
90
+ `SELECT table_name, column_name FROM all_cons_columns WHERE owner = :owner AND constraint_name = :cname`,
91
+ { owner: row.R_OWNER, cname: row.R_CONSTRAINT_NAME },
92
+ { outFormat: oracledb.OUT_FORMAT_OBJECT }
93
+ );
94
+ if (refRes.rows && refRes.rows.length > 0) {
95
+ table.foreignKeys.push({
96
+ name: row.CONSTRAINT_NAME,
97
+ columns: [row.COLUMN_NAME],
98
+ referencedTable: refRes.rows[0].TABLE_NAME,
99
+ referencedColumns: [refRes.rows[0].COLUMN_NAME]
100
+ });
101
+ }
102
+ }
103
+ }
104
+ return schema;
105
+ }
106
+ async insertBatch(batch) {
107
+ if (!this.connection) throw new Error("Not connected");
108
+ const { tableName, rows } = batch;
109
+ if (rows.length === 0) return;
110
+ const columns = Object.keys(rows[0]);
111
+ const bindDefs = {};
112
+ for (const col of columns) {
113
+ bindDefs[col] = { type: oracledb.STRING, maxSize: 4e3 };
114
+ }
115
+ const query = `INSERT INTO "${tableName}" (${columns.map((c) => `"${c}"`).join(", ")}) VALUES (${columns.map((c) => `:${c}`).join(", ")})`;
116
+ await this.connection.executeMany(query, rows, {
117
+ autoCommit: false,
118
+ bindDefs
119
+ });
120
+ }
121
+ async truncateTables(tableNames) {
122
+ if (!this.connection) throw new Error("Not connected");
123
+ for (const table of tableNames) {
124
+ try {
125
+ await this.connection.execute(`TRUNCATE TABLE "${table}"`);
126
+ } catch (err) {
127
+ await this.connection.execute(`DELETE FROM "${table}"`);
128
+ }
129
+ }
130
+ }
131
+ capabilities = {
132
+ enums: false,
133
+ deferrableConstraints: true,
134
+ returning: true,
135
+ identityInsert: true
136
+ };
137
+ mapOracleType(oracleType) {
138
+ const type = oracleType.toUpperCase();
139
+ if (type.includes("NUMBER")) return NormalizedSqlType.DECIMAL;
140
+ if (type.includes("INTEGER") || type.includes("INT")) return NormalizedSqlType.INT;
141
+ if (type.includes("CHAR") || type.includes("CLOB")) return NormalizedSqlType.STRING;
142
+ if (type.includes("DATE") || type.includes("TIMESTAMP")) return NormalizedSqlType.DATETIME;
143
+ if (type.includes("RAW")) return NormalizedSqlType.BINARY;
144
+ if (type.includes("BLOB")) return NormalizedSqlType.BINARY;
145
+ return NormalizedSqlType.STRING;
146
+ }
147
+ };
148
+ function createOracleAdapter(config) {
149
+ return new OracleAdapter(config);
150
+ }
151
+ export {
152
+ OracleAdapter,
153
+ createOracleAdapter
154
+ };
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import oracledb from 'oracledb'\nimport {\n SqlAdapter,\n SchemaGraph,\n SeedBatch,\n NormalizedSqlType,\n TableSchema,\n ColumnSchema\n} from 'schema-seed-core'\n\nexport class OracleAdapter implements SqlAdapter {\n private connection: oracledb.Connection | null = null\n private config: oracledb.ConnectionAttributes\n\n constructor(config: oracledb.ConnectionAttributes) {\n this.config = config\n }\n\n async connect(): Promise<void> {\n this.connection = await oracledb.getConnection(this.config)\n }\n\n async disconnect(): Promise<void> {\n if (this.connection) {\n await this.connection.close()\n this.connection = null\n }\n }\n\n async begin(): Promise<void> {\n // Oracle doesn't have a specific BEGIN command like Postgres/MySQL\n // Transactions start automatically with the first DML statement.\n // We just need to ensure autoCommit is false (which it is by default).\n }\n\n async commit(): Promise<void> {\n await this.connection?.commit()\n }\n\n async rollback(): Promise<void> {\n await this.connection?.rollback()\n }\n\n async introspectSchema(): Promise<SchemaGraph> {\n if (!this.connection) throw new Error('Not connected')\n\n const schema: SchemaGraph = { tables: {} }\n const user = this.config.user?.toUpperCase()\n\n // Get tables\n const tablesRes = await this.connection.execute<{ TABLE_NAME: string, OWNER: string }>(\n `SELECT table_name, owner FROM all_tables WHERE owner = :owner`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (tablesRes.rows || [])) {\n const tableName = row.TABLE_NAME\n schema.tables[tableName] = {\n name: tableName,\n schema: row.OWNER,\n columns: {},\n foreignKeys: [],\n uniqueConstraints: []\n }\n }\n\n // Get columns\n const columnsRes = await this.connection.execute<{\n TABLE_NAME: string,\n COLUMN_NAME: string,\n DATA_TYPE: string,\n NULLABLE: string,\n DATA_DEFAULT: any,\n IDENTITY_COLUMN: string\n }>(\n `SELECT table_name, column_name, data_type, nullable, data_default, identity_column \n FROM all_tab_columns \n WHERE owner = :owner`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (columnsRes.rows || [])) {\n if (!schema.tables[row.TABLE_NAME]) continue\n\n const col: ColumnSchema = {\n name: row.COLUMN_NAME,\n type: this.mapOracleType(row.DATA_TYPE),\n rawType: row.DATA_TYPE,\n nullable: row.NULLABLE === 'Y',\n defaultValue: row.DATA_DEFAULT,\n isAutoIncrement: row.IDENTITY_COLUMN === 'YES'\n }\n schema.tables[row.TABLE_NAME].columns[row.COLUMN_NAME] = col\n }\n\n // Get Constraints (PK, FK, Unique)\n const constraintsRes = await this.connection.execute<{\n TABLE_NAME: string,\n CONSTRAINT_NAME: string,\n CONSTRAINT_TYPE: string,\n COLUMN_NAME: string,\n R_OWNER: string,\n R_CONSTRAINT_NAME: string\n }>(\n `SELECT c.table_name, c.constraint_name, c.constraint_type, col.column_name, c.r_owner, c.r_constraint_name\n FROM all_constraints c\n JOIN all_cons_columns col ON c.owner = col.owner AND c.constraint_name = col.constraint_name\n WHERE c.owner = :owner AND c.constraint_type IN ('P', 'R', 'U')`,\n { owner: user },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n for (const row of (constraintsRes.rows || [])) {\n const table = schema.tables[row.TABLE_NAME]\n if (!table) continue\n\n if (row.CONSTRAINT_TYPE === 'P') {\n if (!table.primaryKey) table.primaryKey = { columns: [] }\n table.primaryKey.columns.push(row.COLUMN_NAME)\n } else if (row.CONSTRAINT_TYPE === 'U') {\n let constraint = table.uniqueConstraints.find(uc => uc.name === row.CONSTRAINT_NAME)\n if (!constraint) {\n constraint = { name: row.CONSTRAINT_NAME, columns: [] }\n table.uniqueConstraints.push(constraint)\n }\n constraint.columns.push(row.COLUMN_NAME)\n } else if (row.CONSTRAINT_TYPE === 'R') {\n // Foreign Key\n // We need to find the referenced table name from the referenced constraint\n const refRes = await this.connection.execute<{ TABLE_NAME: string, COLUMN_NAME: string }>(\n `SELECT table_name, column_name FROM all_cons_columns WHERE owner = :owner AND constraint_name = :cname`,\n { owner: row.R_OWNER, cname: row.R_CONSTRAINT_NAME },\n { outFormat: oracledb.OUT_FORMAT_OBJECT }\n )\n\n if (refRes.rows && refRes.rows.length > 0) {\n table.foreignKeys.push({\n name: row.CONSTRAINT_NAME,\n columns: [row.COLUMN_NAME],\n referencedTable: refRes.rows[0].TABLE_NAME,\n referencedColumns: [refRes.rows[0].COLUMN_NAME]\n })\n }\n }\n }\n\n return schema\n }\n\n async insertBatch(batch: SeedBatch): Promise<void> {\n if (!this.connection) throw new Error('Not connected')\n const { tableName, rows } = batch\n if (rows.length === 0) return\n\n const columns = Object.keys(rows[0])\n const bindDefs: Record<string, any> = {}\n\n // Oracle executeMany requires bindDefs for better performance and type safety\n for (const col of columns) {\n // We'll infer type from the first row or just use default\n bindDefs[col] = { type: oracledb.STRING, maxSize: 4000 } // Default to string for simplicity\n }\n\n const query = `INSERT INTO \"${tableName}\" (${columns.map(c => `\"${c}\"`).join(', ')}) VALUES (${columns.map(c => `:${c}`).join(', ')})`\n\n await this.connection.executeMany(query, rows, {\n autoCommit: false,\n bindDefs\n })\n }\n\n async truncateTables(tableNames: string[]): Promise<void> {\n if (!this.connection) throw new Error('Not connected')\n\n for (const table of tableNames) {\n try {\n await this.connection.execute(`TRUNCATE TABLE \"${table}\"`)\n } catch (err: any) {\n // Fallback to DELETE if TRUNCATE fails (e.g. due to FKs or permissions)\n await this.connection.execute(`DELETE FROM \"${table}\"`)\n }\n }\n }\n\n readonly capabilities = {\n enums: false,\n deferrableConstraints: true,\n returning: true,\n identityInsert: true\n }\n\n private mapOracleType(oracleType: string): NormalizedSqlType {\n const type = oracleType.toUpperCase()\n if (type.includes('NUMBER')) return NormalizedSqlType.DECIMAL\n if (type.includes('INTEGER') || type.includes('INT')) return NormalizedSqlType.INT\n if (type.includes('CHAR') || type.includes('CLOB')) return NormalizedSqlType.STRING\n if (type.includes('DATE') || type.includes('TIMESTAMP')) return NormalizedSqlType.DATETIME\n if (type.includes('RAW')) return NormalizedSqlType.BINARY\n if (type.includes('BLOB')) return NormalizedSqlType.BINARY\n\n return NormalizedSqlType.STRING\n }\n}\n\nexport function createOracleAdapter(config: oracledb.ConnectionAttributes): OracleAdapter {\n return new OracleAdapter(config)\n}\n"],"mappings":";AAAA,OAAO,cAAc;AACrB;AAAA,EAIE;AAAA,OAGK;AAEA,IAAM,gBAAN,MAA0C;AAAA,EACvC,aAAyC;AAAA,EACzC;AAAA,EAER,YAAY,QAAuC;AACjD,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,UAAyB;AAC7B,SAAK,aAAa,MAAM,SAAS,cAAc,KAAK,MAAM;AAAA,EAC5D;AAAA,EAEA,MAAM,aAA4B;AAChC,QAAI,KAAK,YAAY;AACnB,YAAM,KAAK,WAAW,MAAM;AAC5B,WAAK,aAAa;AAAA,IACpB;AAAA,EACF;AAAA,EAEA,MAAM,QAAuB;AAAA,EAI7B;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,KAAK,YAAY,OAAO;AAAA,EAChC;AAAA,EAEA,MAAM,WAA0B;AAC9B,UAAM,KAAK,YAAY,SAAS;AAAA,EAClC;AAAA,EAEA,MAAM,mBAAyC;AAC7C,QAAI,CAAC,KAAK,WAAY,OAAM,IAAI,MAAM,eAAe;AAErD,UAAM,SAAsB,EAAE,QAAQ,CAAC,EAAE;AACzC,UAAM,OAAO,KAAK,OAAO,MAAM,YAAY;AAG3C,UAAM,YAAY,MAAM,KAAK,WAAW;AAAA,MACtC;AAAA,MACA,EAAE,OAAO,KAAK;AAAA,MACd,EAAE,WAAW,SAAS,kBAAkB;AAAA,IAC1C;AAEA,eAAW,OAAQ,UAAU,QAAQ,CAAC,GAAI;AACxC,YAAM,YAAY,IAAI;AACtB,aAAO,OAAO,SAAS,IAAI;AAAA,QACzB,MAAM;AAAA,QACN,QAAQ,IAAI;AAAA,QACZ,SAAS,CAAC;AAAA,QACV,aAAa,CAAC;AAAA,QACd,mBAAmB,CAAC;AAAA,MACtB;AAAA,IACF;AAGA,UAAM,aAAa,MAAM,KAAK,WAAW;AAAA,MAQvC;AAAA;A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WAAW,QAAQ,gBAAgB,KAAK,GAAG;AAAA,MACxD;AAAA,IACF;AAAA,EACF;AAAA,EAES,eAAe;AAAA,IACtB,OAAO;AAAA,IACP,uBAAuB;AAAA,IACvB,WAAW;AAAA,IACX,gBAAgB;AAAA,EAClB;AAAA,EAEQ,cAAc,YAAuC;AAC3D,UAAM,OAAO,WAAW,YAAY;AACpC,QAAI,KAAK,SAAS,QAAQ,EAAG,QAAO,kBAAkB;AACtD,QAAI,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,KAAK,EAAG,QAAO,kBAAkB;AAC/E,QAAI,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,EAAG,QAAO,kBAAkB;AAC7E,QAAI,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,WAAW,EAAG,QAAO,kBAAkB;AAClF,QAAI,KAAK,SAAS,KAAK,EAAG,QAAO,kBAAkB;AACnD,QAAI,KAAK,SAAS,MAAM,EAAG,QAAO,kBAAkB;AAEpD,WAAO,kBAAkB;AAAA,EAC3B;AACF;AAEO,SAAS,oBAAoB,QAAsD;AACxF,SAAO,IAAI,cAAc,MAAM;AACjC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "schema-seed-adapter-oracle",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Oracle adapter for schema-seed",
6
+ "author": "Ali Nazar",
7
+ "license": "MIT",
8
+ "private": false,
9
+ "sideEffects": false,
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/alinazar-111/schema-seed.git"
13
+ },
14
+ "homepage": "https://github.com/alinazar-111/schema-seed#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/alinazar-111/schema-seed/issues"
17
+ },
18
+ "keywords": [
19
+ "database",
20
+ "seeding",
21
+ "test-data",
22
+ "adapter",
23
+ "schema-seed"
24
+ ],
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.cjs"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "dependencies": {
41
+ "oracledb": "^6.6.0",
42
+ "schema-seed-core": "0.1.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/oracledb": "^6.10.0",
46
+ "tsup": "^8.3.5",
47
+ "typescript": "^5.7.2",
48
+ "vitest": "^2.1.8"
49
+ },
50
+ "scripts": {
51
+ "build": "tsup",
52
+ "clean": "rm -rf dist",
53
+ "dev": "tsup --watch",
54
+ "lint": "eslint .",
55
+ "test": "vitest run --passWithNoTests",
56
+ "typecheck": "tsc --noEmit"
57
+ }
58
+ }