mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 10:29:11 +00:00

* 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>
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
/* eslint-env jest */
|
|
import { toOracle } from "../src/utils/exportSQL/oracle.js";
|
|
import { DB } from "../src/data/constants.js";
|
|
|
|
describe("toOracle", () => {
|
|
test("test for unique index creation", () => {
|
|
const diagram = {
|
|
database: DB.ORACLE,
|
|
tables: [
|
|
{
|
|
name: "mochila",
|
|
fields: [
|
|
{
|
|
name: "mochila_id",
|
|
type: "NUMBER",
|
|
size: "10,0",
|
|
notNull: true,
|
|
primary: true,
|
|
default: "",
|
|
},
|
|
{
|
|
name: "capacidad_kg",
|
|
type: "NUMBER",
|
|
size: "2,0",
|
|
notNull: true,
|
|
default: "",
|
|
},
|
|
{
|
|
name: "compartimentos",
|
|
type: "NUMBER",
|
|
size: "2,0",
|
|
notNull: true,
|
|
default: "",
|
|
},
|
|
],
|
|
indices: [
|
|
{
|
|
name: "mochila_index_0",
|
|
fields: ["capacidad_kg", "compartimentos"],
|
|
unique: true,
|
|
}
|
|
],
|
|
},
|
|
],
|
|
references: [],
|
|
};
|
|
|
|
const expectedSQL = `CREATE TABLE mochila (
|
|
\t"mochila_id" NUMBER(10,0) NOT NULL,
|
|
\t"capacidad_kg" NUMBER(2,0) NOT NULL,
|
|
\t"compartimentos" NUMBER(2,0) NOT NULL,
|
|
\tCONSTRAINT mochila_pk PRIMARY KEY("mochila_id")
|
|
);
|
|
|
|
|
|
CREATE UNIQUE INDEX "mochila_index_0" ON mochila ("capacidad_kg", "compartimentos");
|
|
`;
|
|
|
|
const result = toOracle(diagram);
|
|
expect(result.trim()).toBe(expectedSQL.trim());
|
|
});
|
|
});
|