mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
oracle - using default schema
This commit is contained in:
parent
2723c41832
commit
df60d40134
@ -57,6 +57,9 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
password,
|
password,
|
||||||
connectString: useDatabaseUrl ? databaseUrl : port ? `${server}:${port}/${serviceName}` : server,
|
connectString: useDatabaseUrl ? databaseUrl : port ? `${server}:${port}/${serviceName}` : server,
|
||||||
});
|
});
|
||||||
|
if (database) {
|
||||||
|
await client.execute(`ALTER SESSION SET CURRENT_SCHEMA = ${database}`);
|
||||||
|
}
|
||||||
client._schema_name = database;
|
client._schema_name = database;
|
||||||
return client;
|
return client;
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select
|
select
|
||||||
owner as "schema_name",
|
-- owner as "schema_name",
|
||||||
table_name as "pure_name",
|
table_name as "pure_name",
|
||||||
column_name as "column_name",
|
column_name as "column_name",
|
||||||
nullable as "is_nullable",
|
nullable as "is_nullable",
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select fk.constraint_name as "constraint_name",
|
select fk.constraint_name as "constraint_name",
|
||||||
fk.owner as "constraint_schema",
|
-- fk.owner as "constraint_schema",
|
||||||
fk.table_name as "pure_name",
|
fk.table_name as "pure_name",
|
||||||
fk.owner as "schema_name",
|
-- fk.owner as "schema_name",
|
||||||
fk.delete_rule as "update_action",
|
fk.delete_rule as "update_action",
|
||||||
fk.delete_rule as "delete_action",
|
fk.delete_rule as "delete_action",
|
||||||
ref.table_name as "ref_table_name",
|
ref.table_name as "ref_table_name",
|
||||||
ref.owner as "ref_schema_name",
|
-- ref.owner as "ref_schema_name",
|
||||||
basecol.column_name as "column_name",
|
basecol.column_name as "column_name",
|
||||||
refcol.column_name as "ref_column_name"
|
refcol.column_name as "ref_column_name"
|
||||||
from all_cons_columns refcol, all_cons_columns basecol, all_constraints ref, all_constraints fk
|
from all_cons_columns refcol, all_cons_columns basecol, all_constraints ref, all_constraints fk
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select i.table_name as "tableName",
|
select i.table_name as "tableName",
|
||||||
i.table_owner as "schemaName",
|
-- i.table_owner as "schemaName",
|
||||||
i.index_name as "constraintName",
|
i.index_name as "constraintName",
|
||||||
i.index_type as "indexType",
|
i.index_type as "indexType",
|
||||||
i.uniqueness as "Unique",
|
i.uniqueness as "Unique",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
SELECT owner "schema_name"
|
SELECT -- owner "schema_name"
|
||||||
, table_name "pure_name"
|
table_name "pure_name"
|
||||||
, column_name "column_name"
|
, column_name "column_name"
|
||||||
, data_type "data_type"
|
, data_type "data_type"
|
||||||
FROM all_tab_columns av
|
FROM all_tab_columns av
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
SELECT owner as schema_name,
|
SELECT -- owner as schema_name,
|
||||||
mview_name pure_name,
|
mview_name pure_name,
|
||||||
container_name,
|
container_name,
|
||||||
'' || trim(
|
'' || trim(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select
|
select
|
||||||
pk.owner as "constraint_schema",
|
-- pk.owner as "constraint_schema",
|
||||||
pk.constraint_name as "constraint_name",
|
pk.constraint_name as "constraint_name",
|
||||||
pk.owner as "schema_name",
|
pk.owner as "schema_name",
|
||||||
pk.table_name as "pure_name",
|
pk.table_name as "pure_name",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select
|
select
|
||||||
routine_name as "pure_name",
|
routine_name as "pure_name",
|
||||||
routine_schema as "schema_name",
|
-- routine_schema as "schema_name",
|
||||||
routine_definition as "definition",
|
routine_definition as "definition",
|
||||||
standard_hash(routine_definition, 'MD5') as "hash_code",
|
standard_hash(routine_definition, 'MD5') as "hash_code",
|
||||||
routine_type as "object_type",
|
routine_type as "object_type",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = `
|
module.exports = `
|
||||||
select
|
select
|
||||||
owner "schema_name",
|
-- owner "schema_name",
|
||||||
table_name "pure_name"
|
table_name "pure_name"
|
||||||
from
|
from
|
||||||
all_tables
|
all_tables
|
||||||
|
@ -3,7 +3,7 @@ select avv.*,
|
|||||||
ora_hash("create_sql") as "hash_code"
|
ora_hash("create_sql") as "hash_code"
|
||||||
from (select
|
from (select
|
||||||
view_name as "pure_name",
|
view_name as "pure_name",
|
||||||
owner as "schema_name",
|
-- owner as "schema_name",
|
||||||
SUBSTR(text_vc, 1, 3900) AS "create_sql"
|
SUBSTR(text_vc, 1, 3900) AS "create_sql"
|
||||||
from all_views av
|
from all_views av
|
||||||
where owner = '$owner' and text_vc is not null
|
where owner = '$owner' and text_vc is not null
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_TOOLS;
|
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {
|
||||||
|
createDatabase(name) {
|
||||||
|
this.putCmd(`CREATE USER c##${name}
|
||||||
|
IDENTIFIED BY ${name}
|
||||||
|
DEFAULT TABLESPACE users
|
||||||
|
TEMPORARY TABLESPACE temp
|
||||||
|
QUOTA 10M ON users;`, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @param type {import('dbgate-types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
transform(type, dumpExpr) {
|
transform(type, dumpExpr) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user