mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-16 03:02:43 +00:00
Pull-request para export a Oracle (#4)
* Permito deployment en un subfolder
* Remove vercel/analytics
* Remove vercel/analytics
* Remove vercel/analytics
* Revert "Permito deployment en un subfolder"
This reverts commit e7aedc3ecf
.
* Boton de oracle funciona pero no add table
* datatypes.js fixed
* export oracle funciona, falta formato adecuado
* Agregando convenciones a constraints
* Cambiando detalle de unique constraint
* Adding a test for diagram exports to oracle
* tests for constraints added
* Correccion de la funcion check
* vercel added and tests run with npm run lint
* little fixes, vercel added in datatypes and main.jsx
* Delete tatus file added by mistake
---------
Co-authored-by: Francisco-Galindo <paqui10718@gmail.com>
Co-authored-by: hansmarcus <hansmarcus14@gmail.com>
Co-authored-by: Pablo Estrada <pabloem@apache.org>
This commit is contained in:
46
test/oracle_unique.test.js
Normal file
46
test/oracle_unique.test.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/* eslint-env jest */
|
||||
import { toOracle } from "../src/utils/exportSQL/oracle.js";
|
||||
import { DB } from "../src/data/constants.js";
|
||||
|
||||
describe("toOracle", () => {
|
||||
test("test for unique constraints", () => {
|
||||
const diagram = {
|
||||
database: DB.ORACLE,
|
||||
tables: [
|
||||
{
|
||||
name: "computador",
|
||||
fields: [
|
||||
{
|
||||
name: "computador_id",
|
||||
type: "NUMBER",
|
||||
size: "10,0",
|
||||
notNull: true,
|
||||
primary: true,
|
||||
default: "",
|
||||
},
|
||||
{
|
||||
name: "num_serie",
|
||||
type: "VARCHAR2",
|
||||
size: 40,
|
||||
notNull: true,
|
||||
unique: true,
|
||||
default: "",
|
||||
},
|
||||
],
|
||||
indices: [],
|
||||
},
|
||||
],
|
||||
references: [],
|
||||
};
|
||||
|
||||
const expectedSQL = `CREATE TABLE computador (
|
||||
\t"computador_id" NUMBER(10,0) NOT NULL,
|
||||
\t"num_serie" VARCHAR2(40) NOT NULL,
|
||||
\tCONSTRAINT computador_num_serie_uk UNIQUE("num_serie"),
|
||||
\tCONSTRAINT computador_pk PRIMARY KEY("computador_id")
|
||||
);`;
|
||||
|
||||
const result = toOracle(diagram);
|
||||
expect(result.trim()).toBe(expectedSQL.trim());
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user