Commit 50df0fe1 authored by Karamel's avatar Karamel
Browse files

Add support for sqlite3.

parent ae825054
......@@ -27,17 +27,18 @@ ident/inifile/path = "auth"
core_database = "single"
; Core database solo (used only when core_database = "solo").
; Database type, either "mysql" or "postgresql".
; Database type, either "mysql", "postgresql" or "sqlite".
database/single/type = "postgresql"
; Database host.
; Database host. Ignored for sqlite.
database/single/host = "localhost"
; Database port. Default is 5432 for postgresql and 3306 for mysql.
; Database port. Default is 5432 for postgresql and 3306 for mysql. Ignored for sqlite.
database/single/port = 5432
; Database user.
; Database user. Ignored for sqlite.
database/single/user = "pasteque"
; Database password.
; Database password. Ignored for sqlite.
database/single/password = "pasteque"
; Database name.
; Database name. For sqlite, this is the path to the database file.
; The sqlite file and it's directory must be writeable by the server user.
database/single/name = "pasteque"
; Core database inifile (used only when core_database = "inifile").
......
CREATE TABLE taxes (id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, rate DOUBLE PRECISION NOT NULL, PRIMARY KEY(id));
CREATE TABLE categories (id INTEGER NOT NULL, parent_id INTEGER DEFAULT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, hasImage BOOLEAN NOT NULL, disp_order INTEGER NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_3AF34668727ACA70 FOREIGN KEY (parent_id) REFERENCES categories (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE UNIQUE INDEX UNIQ_3AF34668AEA34913 ON categories (reference);
CREATE INDEX IDX_3AF34668727ACA70 ON categories (parent_id);
CREATE TABLE paymentmodes (id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, backLabel VARCHAR(255) NOT NULL, type INTEGER NOT NULL, hasImage BOOLEAN NOT NULL, disp_order INTEGER NOT NULL, visible BOOLEAN NOT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_263B9843AEA34913 ON paymentmodes (reference);
CREATE TABLE discountprofiles (id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, rate DOUBLE PRECISION NOT NULL, PRIMARY KEY(id));
CREATE TABLE places (id INTEGER NOT NULL, floor_id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_FEAF6C55854679E2 FOREIGN KEY (floor_id) REFERENCES floors (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_FEAF6C55854679E2 ON places (floor_id);
CREATE TABLE images (model VARCHAR(255) NOT NULL, modelId VARCHAR(255) NOT NULL, mimeType VARCHAR(255) NOT NULL, image BLOB NOT NULL, PRIMARY KEY(model, modelId));
CREATE TABLE fiscaltickets (type VARCHAR(255) NOT NULL, sequence VARCHAR(255) NOT NULL, number INTEGER NOT NULL, date DATETIME NOT NULL, content CLOB NOT NULL, signature VARCHAR(255) NOT NULL, PRIMARY KEY(type, sequence, number));
CREATE TABLE products (id INTEGER NOT NULL, category_id INTEGER NOT NULL, tax_id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, barcode VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, priceBuy DOUBLE PRECISION DEFAULT NULL, priceSell DOUBLE PRECISION NOT NULL, visible BOOLEAN NOT NULL, scaled BOOLEAN NOT NULL, scaleType SMALLINT NOT NULL, scaleValue DOUBLE PRECISION NOT NULL, disp_order INTEGER NOT NULL, hasImage BOOLEAN NOT NULL, discountEnabled BOOLEAN NOT NULL, discountRate DOUBLE PRECISION NOT NULL, prepay BOOLEAN NOT NULL, composition BOOLEAN NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_B3BA5A5A12469DE2 FOREIGN KEY (category_id) REFERENCES categories (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B3BA5A5AB2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE UNIQUE INDEX UNIQ_B3BA5A5AAEA34913 ON products (reference);
CREATE INDEX IDX_B3BA5A5A12469DE2 ON products (category_id);
CREATE INDEX IDX_B3BA5A5AB2A824D8 ON products (tax_id);
CREATE TABLE customers (id INTEGER NOT NULL, tax_id INTEGER DEFAULT NULL, discountprofile_id INTEGER DEFAULT NULL, tariffarea_id INTEGER DEFAULT NULL, dispName VARCHAR(255) NOT NULL, card VARCHAR(255) NOT NULL, firstName VARCHAR(255) NOT NULL, lastName VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, phone1 VARCHAR(255) NOT NULL, phone2 VARCHAR(255) NOT NULL, fax VARCHAR(255) NOT NULL, addr1 VARCHAR(255) NOT NULL, addr2 VARCHAR(255) NOT NULL, zipCode VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, region VARCHAR(255) NOT NULL, country VARCHAR(255) NOT NULL, balance DOUBLE PRECISION NOT NULL, maxDebt DOUBLE PRECISION NOT NULL, note CLOB NOT NULL, visible BOOLEAN NOT NULL, expireDate DATETIME DEFAULT NULL, hasImage BOOLEAN NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_62534E21B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_62534E21E1BC3B58 FOREIGN KEY (discountprofile_id) REFERENCES discountprofiles (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_62534E2154EC7A8F FOREIGN KEY (tariffarea_id) REFERENCES tariffareas (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_62534E21B2A824D8 ON customers (tax_id);
CREATE INDEX IDX_62534E21E1BC3B58 ON customers (discountprofile_id);
CREATE INDEX IDX_62534E2154EC7A8F ON customers (tariffarea_id);
CREATE TABLE discounts (id INTEGER NOT NULL, startDate DATETIME DEFAULT NULL, endDate DATETIME DEFAULT NULL, rate DOUBLE PRECISION NOT NULL, barcode VARCHAR(255) DEFAULT NULL, barcodeType INTEGER NOT NULL, disp_order INTEGER NOT NULL, PRIMARY KEY(id));
CREATE TABLE sessions (id INTEGER NOT NULL, cashregister_id INTEGER NOT NULL, sequence INTEGER NOT NULL, continuous BOOLEAN NOT NULL, openDate DATETIME DEFAULT NULL, closeDate DATETIME DEFAULT NULL, openCash DOUBLE PRECISION DEFAULT NULL, closeCash DOUBLE PRECISION DEFAULT NULL, expectedCash DOUBLE PRECISION DEFAULT NULL, ticketCount INTEGER DEFAULT NULL, custCount INTEGER DEFAULT NULL, cs DOUBLE PRECISION DEFAULT NULL, csPeriod DOUBLE PRECISION NOT NULL, csFYear DOUBLE PRECISION NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_9A609D139ED3320C FOREIGN KEY (cashregister_id) REFERENCES cashregisters (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_9A609D139ED3320C ON sessions (cashregister_id);
CREATE UNIQUE INDEX session_index ON sessions (cashregister_id, sequence);
CREATE TABLE cashregisters (id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, nextTicketId INTEGER NOT NULL, nextSessionId INTEGER NOT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_4DC8569BAEA34913 ON cashregisters (reference);
CREATE TABLE sessioncustbalances (cashsession_id INTEGER NOT NULL, customer_id INTEGER NOT NULL, balance DOUBLE PRECISION NOT NULL, PRIMARY KEY(cashsession_id, customer_id), CONSTRAINT FK_9D3CBD8BC914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_9D3CBD8B9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_9D3CBD8BC914703E ON sessioncustbalances (cashsession_id);
CREATE INDEX IDX_9D3CBD8B9395C3F3 ON sessioncustbalances (customer_id);
CREATE TABLE floors (id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, image BLOB DEFAULT NULL, disp_order INTEGER NOT NULL, PRIMARY KEY(id));
CREATE TABLE ticketlines (ticket_id INTEGER NOT NULL, product_id INTEGER DEFAULT NULL, tax_id INTEGER NOT NULL, dispOrder INTEGER NOT NULL, productLabel VARCHAR(255) NOT NULL, unitPrice DOUBLE PRECISION DEFAULT NULL, taxedUnitPrice DOUBLE PRECISION DEFAULT NULL, quantity DOUBLE PRECISION NOT NULL, price DOUBLE PRECISION DEFAULT NULL, taxedPrice DOUBLE PRECISION NOT NULL, taxRate DOUBLE PRECISION NOT NULL, discountRate DOUBLE PRECISION NOT NULL, finalPrice DOUBLE PRECISION DEFAULT NULL, finalTaxedPrice DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(ticket_id, dispOrder), CONSTRAINT FK_20FFE9B5700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20FFE9B54584665A FOREIGN KEY (product_id) REFERENCES products (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20FFE9B5B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_20FFE9B5700047D2 ON ticketlines (ticket_id);
CREATE INDEX IDX_20FFE9B54584665A ON ticketlines (product_id);
CREATE INDEX IDX_20FFE9B5B2A824D8 ON ticketlines (tax_id);
CREATE TABLE tariffareas (id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, disp_order INTEGER NOT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_A2F17FC9AEA34913 ON tariffareas (reference);
CREATE TABLE sessionpayments (cashsession_id INTEGER NOT NULL, paymentmode_id INTEGER NOT NULL, currency_id INTEGER NOT NULL, amount DOUBLE PRECISION NOT NULL, currencyAmount DOUBLE PRECISION NOT NULL, PRIMARY KEY(cashsession_id, paymentmode_id, currency_id), CONSTRAINT FK_342F815C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_342F815ABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_342F81538248176 FOREIGN KEY (currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_342F815C914703E ON sessionpayments (cashsession_id);
CREATE INDEX IDX_342F815ABEEF95F ON sessionpayments (paymentmode_id);
CREATE INDEX IDX_342F81538248176 ON sessionpayments (currency_id);
CREATE TABLE tickets (id INTEGER NOT NULL, cashregister_id INTEGER NOT NULL, user_id INTEGER NOT NULL, customer_id INTEGER DEFAULT NULL, tariffarea_id INTEGER DEFAULT NULL, discountprofile_id INTEGER DEFAULT NULL, sequence INTEGER NOT NULL, number INTEGER NOT NULL, date DATETIME NOT NULL, custCount INTEGER DEFAULT NULL, discountRate DOUBLE PRECISION NOT NULL, price DOUBLE PRECISION DEFAULT NULL, taxedPrice DOUBLE PRECISION DEFAULT NULL, finalPrice DOUBLE PRECISION NOT NULL, finalTaxedPrice DOUBLE PRECISION NOT NULL, custBalance DOUBLE PRECISION NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_54469DF49ED3320C FOREIGN KEY (cashregister_id) REFERENCES cashregisters (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_54469DF4A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_54469DF49395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_54469DF454EC7A8F FOREIGN KEY (tariffarea_id) REFERENCES tariffareas (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_54469DF4E1BC3B58 FOREIGN KEY (discountprofile_id) REFERENCES discountprofiles (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_54469DF49ED3320C ON tickets (cashregister_id);
CREATE INDEX IDX_54469DF4A76ED395 ON tickets (user_id);
CREATE INDEX IDX_54469DF49395C3F3 ON tickets (customer_id);
CREATE INDEX IDX_54469DF454EC7A8F ON tickets (tariffarea_id);
CREATE INDEX IDX_54469DF4E1BC3B58 ON tickets (discountprofile_id);
CREATE UNIQUE INDEX ticket_index ON tickets (cashregister_id, number);
CREATE TABLE ticketpayments (ticket_id INTEGER NOT NULL, paymentmode_id INTEGER NOT NULL, currency_id INTEGER NOT NULL, dispOrder INTEGER NOT NULL, amount DOUBLE PRECISION NOT NULL, currencyAmount DOUBLE PRECISION NOT NULL, PRIMARY KEY(ticket_id, dispOrder), CONSTRAINT FK_1D56231D700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_1D56231DABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_1D56231D38248176 FOREIGN KEY (currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_1D56231D700047D2 ON ticketpayments (ticket_id);
CREATE INDEX IDX_1D56231DABEEF95F ON ticketpayments (paymentmode_id);
CREATE INDEX IDX_1D56231D38248176 ON ticketpayments (currency_id);
CREATE TABLE sessioncats (cashsession_id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, amount DOUBLE PRECISION NOT NULL, PRIMARY KEY(cashsession_id, reference), CONSTRAINT FK_F32F3B52C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_F32F3B52C914703E ON sessioncats (cashsession_id);
CREATE TABLE compositiongroups (id INTEGER NOT NULL, product_id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, disp_order INTEGER NOT NULL, image BLOB DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_C72568934584665A FOREIGN KEY (product_id) REFERENCES products (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_C72568934584665A ON compositiongroups (product_id);
CREATE TABLE users (id INTEGER NOT NULL, role_id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, active BOOLEAN NOT NULL, hasImage BOOLEAN NOT NULL, card VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_1483A5E9D60322AC FOREIGN KEY (role_id) REFERENCES roles (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_1483A5E9D60322AC ON users (role_id);
CREATE TABLE roles (id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, permissions CLOB NOT NULL, PRIMARY KEY(id));
CREATE TABLE paymentmodereturns (paymentmode_id INTEGER NOT NULL, returnmode_id INTEGER NOT NULL, minAmount DOUBLE PRECISION NOT NULL, PRIMARY KEY(paymentmode_id, minAmount), CONSTRAINT FK_968A92FABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_968A92FCA0BF816 FOREIGN KEY (returnmode_id) REFERENCES paymentmodes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_968A92FABEEF95F ON paymentmodereturns (paymentmode_id);
CREATE INDEX IDX_968A92FCA0BF816 ON paymentmodereturns (returnmode_id);
CREATE TABLE sessiontaxes (cashsession_id INTEGER NOT NULL, tax_id INTEGER NOT NULL, taxRate DOUBLE PRECISION NOT NULL, base DOUBLE PRECISION NOT NULL, basePeriod DOUBLE PRECISION NOT NULL, baseFYear DOUBLE PRECISION NOT NULL, amount DOUBLE PRECISION NOT NULL, amountPeriod DOUBLE PRECISION NOT NULL, amountFYear DOUBLE PRECISION NOT NULL, PRIMARY KEY(cashsession_id, tax_id), CONSTRAINT FK_59DAD7C9C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_59DAD7C9B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_59DAD7C9C914703E ON sessiontaxes (cashsession_id);
CREATE INDEX IDX_59DAD7C9B2A824D8 ON sessiontaxes (tax_id);
CREATE TABLE options (name VARCHAR(255) NOT NULL, system BOOLEAN NOT NULL, content CLOB NOT NULL, PRIMARY KEY(name));
CREATE TABLE tariffareaprices (tariffarea_id INTEGER NOT NULL, product_id INTEGER NOT NULL, tax_id INTEGER DEFAULT NULL, price DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(tariffarea_id, product_id), CONSTRAINT FK_E1F3B96454EC7A8F FOREIGN KEY (tariffarea_id) REFERENCES tariffareas (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_E1F3B9644584665A FOREIGN KEY (product_id) REFERENCES products (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_E1F3B964B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_E1F3B96454EC7A8F ON tariffareaprices (tariffarea_id);
CREATE INDEX IDX_E1F3B9644584665A ON tariffareaprices (product_id);
CREATE INDEX IDX_E1F3B964B2A824D8 ON tariffareaprices (tax_id);
CREATE TABLE compositionproducts (compositiongroup_id INTEGER NOT NULL, product_id INTEGER NOT NULL, disp_order INTEGER NOT NULL, PRIMARY KEY(compositiongroup_id, product_id), CONSTRAINT FK_DA85AC5F976B2F42 FOREIGN KEY (compositiongroup_id) REFERENCES compositiongroups (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_DA85AC5F4584665A FOREIGN KEY (product_id) REFERENCES products (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_DA85AC5F976B2F42 ON compositionproducts (compositiongroup_id);
CREATE INDEX IDX_DA85AC5F4584665A ON compositionproducts (product_id);
CREATE TABLE paymentmodevalues (paymentmode_id INTEGER NOT NULL, value DOUBLE PRECISION NOT NULL, hasImage BOOLEAN NOT NULL, PRIMARY KEY(paymentmode_id, value), CONSTRAINT FK_4CB607B0ABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_4CB607B0ABEEF95F ON paymentmodevalues (paymentmode_id);
CREATE TABLE resources (label VARCHAR(255) NOT NULL, type INTEGER NOT NULL, content BLOB NOT NULL, PRIMARY KEY(label));
CREATE TABLE tickettaxes (ticket_id INTEGER NOT NULL, tax_id INTEGER NOT NULL, taxRate DOUBLE PRECISION NOT NULL, base DOUBLE PRECISION NOT NULL, amount DOUBLE PRECISION NOT NULL, PRIMARY KEY(ticket_id, tax_id), CONSTRAINT FK_AD70C2DB700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_AD70C2DBB2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_AD70C2DB700047D2 ON tickettaxes (ticket_id);
CREATE INDEX IDX_AD70C2DBB2A824D8 ON tickettaxes (tax_id);
CREATE TABLE sessioncattaxes (cashsession_id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, tax_id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, base DOUBLE PRECISION NOT NULL, amount DOUBLE PRECISION NOT NULL, PRIMARY KEY(cashsession_id, reference, tax_id), CONSTRAINT FK_E4084375C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_E4084375B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_E4084375C914703E ON sessioncattaxes (cashsession_id);
CREATE INDEX IDX_E4084375B2A824D8 ON sessioncattaxes (tax_id);
CREATE TABLE currencies (id INTEGER NOT NULL, reference VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, symbol VARCHAR(255) NOT NULL, decimalSeparator VARCHAR(255) NOT NULL, thousandsSeparator VARCHAR(255) NOT NULL, format VARCHAR(255) NOT NULL, rate DOUBLE PRECISION NOT NULL, main BOOLEAN NOT NULL, visible BOOLEAN NOT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_37C44693AEA34913 ON currencies (reference);
CREATE TABLE fiscaltickets (type VARCHAR(255) NOT NULL, sequence VARCHAR(255) NOT NULL, number INTEGER NOT NULL, date DATETIME NOT NULL, content CLOB NOT NULL, signature VARCHAR(255) NOT NULL, PRIMARY KEY(type, sequence, number));
......@@ -56,12 +56,17 @@ class DoctrineDAO implements DAO
throw new DBException('Not database type provided', DBException::CODE_TYPE_ERROR);
}
$driver = DoctrineDAO::getDriverName($dbInfo['type']);
$dbParams = array('dbname' => $dbInfo['name'],
'user' => $dbInfo['user'],
'password' => $dbInfo['password'],
'host' => $dbInfo['host'],
'driver' => $driver,
'charset'=> 'utf8');
if ($dbInfo['type'] !== 'sqlite') {
$dbParams = array('dbname' => $dbInfo['name'],
'user' => $dbInfo['user'],
'password' => $dbInfo['password'],
'host' => $dbInfo['host'],
'driver' => $driver,
'charset'=> 'utf8');
} else {
$dbParams = array('path' => $dbInfo['name'],
'driver' => $driver);
}
$setup = Setup::createAnnotationMetadataConfiguration($path, $isDevMode,
__DIR__ . '/../../../generated/');
......
......@@ -47,12 +47,19 @@ class InifileDB extends DBModule {
if (is_readable($file)) {
$data = parse_ini_file($file);
// Mandatory values
if (empty($data['type']) || empty($data['host'])) { return false; }
if (empty($data['type'])) {
return false;
}
if ($data['type'] !== 'sqlite' && empty($data['host'])) { return false; }
// Set default values
if (empty($data['host'])) {
$data['host'] = null; // For sqlite
}
if (empty($data['port'])) {
switch ($data['type']) {
case 'mysql': $data['port'] = 3306; break;
case 'postgresql': $data['port'] = 5432; break;
case 'sqlite': $data['port'] = null; break;
default: return false;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment