u
This commit is contained in:
21
src/providers/sqlite3/queries/logistics.js
Normal file
21
src/providers/sqlite3/queries/logistics.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as source from '../../mssql/queries/logistics.js';
|
||||
import { translateQueries } from './translate.js';
|
||||
|
||||
const queries = translateQueries(source, 'logistics');
|
||||
export const {
|
||||
CHECK_ACCOUNT_COMPANY,
|
||||
CHECK_ENTITYADDRESS_COMPANY,
|
||||
CHECK_SHIPPING_COMPANY,
|
||||
ACCOUNT_CREATE,
|
||||
ACCOUNT_LIST,
|
||||
ACCOUNT_DELETE,
|
||||
PAYMENT_CREATE,
|
||||
PAYMENT_LIST_BY_MANIFEST,
|
||||
PAYMENT_DELETE,
|
||||
SHIPPING_CREATE,
|
||||
SHIPPING_LIST_BY_MANIFEST,
|
||||
SHIPPING_DELETE,
|
||||
PACKAGE_CREATE,
|
||||
PACKAGE_LIST_BY_SHIPPING,
|
||||
PACKAGE_DELETE,
|
||||
} = queries;
|
||||
@@ -777,6 +777,53 @@ CREATE TABLE IF NOT EXISTS categoryattributevalue (
|
||||
);
|
||||
`;
|
||||
|
||||
export const INIT_ACCOUNT = `
|
||||
CREATE TABLE IF NOT EXISTS account (
|
||||
id INTEGER PRIMARY KEY,
|
||||
company_id INTEGER NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE
|
||||
);
|
||||
`;
|
||||
|
||||
export const INIT_PAYMENT = `
|
||||
CREATE TABLE IF NOT EXISTS payment (
|
||||
id INTEGER PRIMARY KEY,
|
||||
account_id INTEGER NOT NULL,
|
||||
manifest_id INTEGER NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
amount REAL NOT NULL,
|
||||
FOREIGN KEY (account_id) REFERENCES account(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (manifest_id) REFERENCES manifest(id) ON DELETE CASCADE
|
||||
);
|
||||
`;
|
||||
|
||||
export const INIT_SHIPPING = `
|
||||
CREATE TABLE IF NOT EXISTS shipping (
|
||||
id INTEGER PRIMARY KEY,
|
||||
manifest_id INTEGER NOT NULL,
|
||||
"number" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"state" TEXT NOT NULL,
|
||||
FOREIGN KEY (manifest_id) REFERENCES manifest(id) ON DELETE CASCADE
|
||||
);
|
||||
`;
|
||||
|
||||
export const INIT_PACKAGE = `
|
||||
CREATE TABLE IF NOT EXISTS package (
|
||||
id INTEGER PRIMARY KEY,
|
||||
shipping_id INTEGER NOT NULL,
|
||||
entityaddress_id INTEGER NOT NULL,
|
||||
"number" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"state" TEXT NOT NULL,
|
||||
details TEXT,
|
||||
FOREIGN KEY (shipping_id) REFERENCES shipping(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (entityaddress_id) REFERENCES entityaddress(id) ON DELETE NO ACTION
|
||||
);
|
||||
`;
|
||||
|
||||
/** DDL scripts in dependency order for SQLite schema initialization. */
|
||||
export const SCHEMA_SCRIPTS = [
|
||||
INIT_META,
|
||||
@@ -836,4 +883,8 @@ export const SCHEMA_SCRIPTS = [
|
||||
INIT_FILE,
|
||||
INIT_MANIFESTATTACHMENT,
|
||||
INIT_MANIFESTATTACHMENT_TRIGGER,
|
||||
INIT_ACCOUNT,
|
||||
INIT_PAYMENT,
|
||||
INIT_SHIPPING,
|
||||
INIT_PACKAGE,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user