Initial commit

This commit is contained in:
2025-12-07 14:32:46 +00:00
commit 0a0969b8af
4726 changed files with 536089 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
const ColumnCompiler_Oracle = require('../../oracle/schema/oracle-columncompiler');
const { isObject } = require('../../../util/is');
class ColumnCompiler_Oracledb extends ColumnCompiler_Oracle {
constructor() {
super(...arguments);
this.modifiers = ['defaultTo', 'nullable', 'comment', 'checkJson'];
this._addCheckModifiers();
}
datetime(withoutTz) {
let useTz;
if (isObject(withoutTz)) {
({ useTz } = withoutTz);
} else {
useTz = !withoutTz;
}
return useTz ? 'timestamp with local time zone' : 'timestamp';
}
timestamp(withoutTz) {
let useTz;
if (isObject(withoutTz)) {
({ useTz } = withoutTz);
} else {
useTz = !withoutTz;
}
return useTz ? 'timestamp with local time zone' : 'timestamp';
}
checkRegex(regex, constraintName) {
return this._check(
`REGEXP_LIKE(${this.formatter.wrap(
this.getColumnName()
)},${this.client._escapeBinding(regex)})`,
constraintName
);
}
json() {
// implicitly add the check for json
this.columnBuilder._modifiers.checkJson = [
this.formatter.columnize(this.getColumnName()),
];
return 'varchar2(4000)';
}
jsonb() {
return this.json();
}
checkJson(column) {
return `check (${column} is json)`;
}
}
ColumnCompiler_Oracledb.prototype.time = 'timestamp with local time zone';
ColumnCompiler_Oracledb.prototype.uuid = ({ useBinaryUuid = false } = {}) =>
useBinaryUuid ? 'raw(16)' : 'char(36)';
module.exports = ColumnCompiler_Oracledb;

View File

@@ -0,0 +1,19 @@
const TableCompiler_Oracle = require('../../oracle/schema/oracle-tablecompiler');
class TableCompiler_Oracledb extends TableCompiler_Oracle {
constructor(client, tableBuilder) {
super(client, tableBuilder);
}
_setNullableState(column, isNullable) {
const nullability = isNullable ? 'NULL' : 'NOT NULL';
const sql = `alter table ${this.tableName()} modify (${this.formatter.wrap(
column
)} ${nullability})`;
return this.pushQuery({
sql: sql,
});
}
}
module.exports = TableCompiler_Oracledb;

View File

@@ -0,0 +1,13 @@
const ViewBuilder = require('../../../schema/viewbuilder.js');
class ViewBuilder_Oracledb extends ViewBuilder {
constructor() {
super(...arguments);
}
checkOption() {
this._single.checkOption = 'default_option';
}
}
module.exports = ViewBuilder_Oracledb;

View File

@@ -0,0 +1,19 @@
/* eslint max-len: 0 */
const ViewCompiler = require('../../../schema/viewcompiler.js');
class ViewCompiler_Oracledb extends ViewCompiler {
constructor(client, viewCompiler) {
super(client, viewCompiler);
}
createOrReplace() {
this.createQuery(this.columns, this.selectQuery, false, true);
}
createMaterializedView() {
this.createQuery(this.columns, this.selectQuery, true);
}
}
module.exports = ViewCompiler_Oracledb;