Commit a7d93009 authored by Karamel's avatar Karamel
Browse files

Add sql schema from Doctrine.

parent ffdf6b87
CREATE TABLE paymentmodes (id INT AUTO_INCREMENT NOT NULL, reference VARCHAR(255) NOT NULL, `label` VARCHAR(255) NOT NULL, backLabel VARCHAR(255) NOT NULL, type INT NOT NULL, hasImage TINYINT(1) NOT NULL, disp_order INT NOT NULL, visible TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_263B9843AEA34913 (reference), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE resources (`label` VARCHAR(255) NOT NULL, type INT NOT NULL, content LONGBLOB NOT NULL, PRIMARY KEY(`label`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE tickets (id INT AUTO_INCREMENT NOT NULL, cashregister_id INT NOT NULL, user_id INT NOT NULL, customer_id INT DEFAULT NULL, tariffarea_id INT DEFAULT NULL, discountprofile_id INT DEFAULT NULL, sequence INT NOT NULL, number INT NOT NULL, date DATETIME NOT NULL, custCount INT DEFAULT NULL, discountRate DOUBLE PRECISION NOT NULL, price DOUBLE PRECISION NOT NULL, totalAmount DOUBLE PRECISION NOT NULL, discountPrice DOUBLE PRECISION NOT NULL, discountTotal DOUBLE PRECISION NOT NULL, custBalance DOUBLE PRECISION NOT NULL, INDEX IDX_54469DF49ED3320C (cashregister_id), INDEX IDX_54469DF4A76ED395 (user_id), INDEX IDX_54469DF49395C3F3 (customer_id), INDEX IDX_54469DF454EC7A8F (tariffarea_id), INDEX IDX_54469DF4E1BC3B58 (discountprofile_id), UNIQUE INDEX ticket_index (cashregister_id, number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE floors (id INT AUTO_INCREMENT NOT NULL, `label` VARCHAR(255) NOT NULL, image LONGBLOB DEFAULT NULL, disp_order INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE compositiongroups (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, `label` VARCHAR(255) NOT NULL, disp_order INT NOT NULL, image LONGBLOB DEFAULT NULL, INDEX IDX_C72568934584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE sessioncustbalances (cashsession_id INT NOT NULL, customer_id INT NOT NULL, balance DOUBLE PRECISION NOT NULL, INDEX IDX_9D3CBD8BC914703E (cashsession_id), INDEX IDX_9D3CBD8B9395C3F3 (customer_id), PRIMARY KEY(cashsession_id, customer_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE sessiontaxes (cashsession_id INT NOT NULL, tax_id INT NOT NULL, taxRate DOUBLE PRECISION NOT NULL, base DOUBLE PRECISION NOT NULL, amount DOUBLE PRECISION NOT NULL, INDEX IDX_59DAD7C9C914703E (cashsession_id), INDEX IDX_59DAD7C9B2A824D8 (tax_id), PRIMARY KEY(cashsession_id, tax_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE products (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, tax_id INT NOT NULL, reference VARCHAR(255) NOT NULL, barcode VARCHAR(255) DEFAULT NULL, `label` VARCHAR(255) NOT NULL, priceBuy DOUBLE PRECISION DEFAULT NULL, priceSell DOUBLE PRECISION NOT NULL, visible TINYINT(1) NOT NULL, scaled TINYINT(1) NOT NULL, scaleType SMALLINT NOT NULL, scaleValue DOUBLE PRECISION NOT NULL, disp_order INT NOT NULL, hasImage TINYINT(1) NOT NULL, discountEnabled TINYINT(1) NOT NULL, discountRate DOUBLE PRECISION NOT NULL, prepay TINYINT(1) NOT NULL, composition TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_B3BA5A5AAEA34913 (reference), INDEX IDX_B3BA5A5A12469DE2 (category_id), INDEX IDX_B3BA5A5AB2A824D8 (tax_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE customers (id INT AUTO_INCREMENT NOT NULL, tax_id INT DEFAULT NULL, discountprofile_id INT 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 LONGTEXT NOT NULL, visible TINYINT(1) NOT NULL, expireDate DATETIME DEFAULT NULL, hasImage TINYINT(1) NOT NULL, INDEX IDX_62534E21B2A824D8 (tax_id), INDEX IDX_62534E21E1BC3B58 (discountprofile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE sessioncats (cashsession_id INT NOT NULL, reference VARCHAR(255) NOT NULL, `label` VARCHAR(255) NOT NULL, amount DOUBLE PRECISION NOT NULL, INDEX IDX_F32F3B52C914703E (cashsession_id), PRIMARY KEY(cashsession_id, reference)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE paymentmodereturns (paymentmode_id INT NOT NULL, returnmode_id INT NOT NULL, minAmount DOUBLE PRECISION NOT NULL, INDEX IDX_968A92FABEEF95F (paymentmode_id), INDEX IDX_968A92FCA0BF816 (returnmode_id), PRIMARY KEY(paymentmode_id, minAmount)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE images (model VARCHAR(255) NOT NULL, modelId VARCHAR(255) NOT NULL, mimeType VARCHAR(255) NOT NULL, image LONGBLOB NOT NULL, PRIMARY KEY(model, modelId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE places (id INT AUTO_INCREMENT NOT NULL, floor_id INT NOT NULL, `label` VARCHAR(255) NOT NULL, x INT NOT NULL, y INT NOT NULL, INDEX IDX_FEAF6C55854679E2 (floor_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE tariffareaprices (tariffarea_id INT NOT NULL, product_id INT NOT NULL, tax_id INT DEFAULT NULL, price DOUBLE PRECISION DEFAULT NULL, INDEX IDX_E1F3B96454EC7A8F (tariffarea_id), INDEX IDX_E1F3B9644584665A (product_id), INDEX IDX_E1F3B964B2A824D8 (tax_id), PRIMARY KEY(tariffarea_id, product_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE compositionproducts (compositiongroup_id INT NOT NULL, product_id INT NOT NULL, disp_order INT NOT NULL, INDEX IDX_DA85AC5F976B2F42 (compositiongroup_id), INDEX IDX_DA85AC5F4584665A (product_id), PRIMARY KEY(compositiongroup_id, product_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE cashregisters (id INT AUTO_INCREMENT NOT NULL, reference VARCHAR(255) NOT NULL, `label` VARCHAR(255) NOT NULL, nextTicketId INT NOT NULL, nextSessionId INT NOT NULL, UNIQUE INDEX UNIQ_4DC8569BAEA34913 (reference), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE sessionpayments (cashsession_id INT NOT NULL, paymentmode_id INT NOT NULL, currency_id INT NOT NULL, amount DOUBLE PRECISION NOT NULL, currencyAmount DOUBLE PRECISION NOT NULL, INDEX IDX_342F815C914703E (cashsession_id), INDEX IDX_342F815ABEEF95F (paymentmode_id), INDEX IDX_342F81538248176 (currency_id), PRIMARY KEY(cashsession_id, paymentmode_id, currency_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE ticketlines (ticket_id INT NOT NULL, product_id INT DEFAULT NULL, tax_id INT NOT NULL, dispOrder INT NOT NULL, productLabel VARCHAR(255) NOT NULL, unitPrice DOUBLE PRECISION NOT NULL, quantity DOUBLE PRECISION NOT NULL, price DOUBLE PRECISION NOT NULL, taxRate DOUBLE PRECISION NOT NULL, taxAmount DOUBLE PRECISION NOT NULL, totalAmount DOUBLE PRECISION NOT NULL, discountRate DOUBLE PRECISION NOT NULL, discountPrice DOUBLE PRECISION NOT NULL, discountTax DOUBLE PRECISION NOT NULL, discountTotal DOUBLE PRECISION NOT NULL, INDEX IDX_20FFE9B5700047D2 (ticket_id), INDEX IDX_20FFE9B54584665A (product_id), INDEX IDX_20FFE9B5B2A824D8 (tax_id), PRIMARY KEY(ticket_id, dispOrder)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE sessions (id INT AUTO_INCREMENT NOT NULL, cashregister_id INT NOT NULL, sequence INT NOT NULL, continuous TINYINT(1) 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 INT DEFAULT NULL, custCount INT DEFAULT NULL, cs DOUBLE PRECISION DEFAULT NULL, INDEX IDX_9A609D139ED3320C (cashregister_id), UNIQUE INDEX session_index (cashregister_id, sequence), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE ticketpayments (ticket_id INT NOT NULL, paymentmode_id INT NOT NULL, currency_id INT NOT NULL, dispOrder INT NOT NULL, amount DOUBLE PRECISION NOT NULL, currencyAmount DOUBLE PRECISION NOT NULL, INDEX IDX_1D56231D700047D2 (ticket_id), INDEX IDX_1D56231DABEEF95F (paymentmode_id), INDEX IDX_1D56231D38248176 (currency_id), PRIMARY KEY(ticket_id, dispOrder)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE categories (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, reference VARCHAR(255) NOT NULL, `label` VARCHAR(255) NOT NULL, hasImage TINYINT(1) NOT NULL, disp_order INT NOT NULL, UNIQUE INDEX UNIQ_3AF34668AEA34913 (reference), INDEX IDX_3AF34668727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE tickettaxes (ticket_id INT NOT NULL, tax_id INT NOT NULL, taxRate DOUBLE PRECISION NOT NULL, base DOUBLE PRECISION NOT NULL, amount DOUBLE PRECISION NOT NULL, INDEX IDX_AD70C2DB700047D2 (ticket_id), INDEX IDX_AD70C2DBB2A824D8 (tax_id), PRIMARY KEY(ticket_id, tax_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE discounts (id INT AUTO_INCREMENT NOT NULL, startDate DATETIME DEFAULT NULL, endDate DATETIME DEFAULT NULL, rate DOUBLE PRECISION NOT NULL, barcode VARCHAR(255) DEFAULT NULL, barcodeType INT NOT NULL, disp_order INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE tariffareas (id INT AUTO_INCREMENT NOT NULL, reference VARCHAR(255) NOT NULL, `label` VARCHAR(255) NOT NULL, disp_order INT NOT NULL, UNIQUE INDEX UNIQ_A2F17FC9AEA34913 (reference), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE currencies (id INT AUTO_INCREMENT 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 TINYINT(1) NOT NULL, visible TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_37C44693AEA34913 (reference), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE paymentmodevalues (paymentmode_id INT NOT NULL, value DOUBLE PRECISION NOT NULL, hasImage TINYINT(1) NOT NULL, INDEX IDX_4CB607B0ABEEF95F (paymentmode_id), PRIMARY KEY(paymentmode_id, value)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE fiscaltickets (type VARCHAR(255) NOT NULL, sequence VARCHAR(255) NOT NULL, number INT NOT NULL, content LONGTEXT NOT NULL, signature VARCHAR(255) NOT NULL, PRIMARY KEY(type, sequence, number)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE discountprofiles (id INT AUTO_INCREMENT NOT NULL, `label` VARCHAR(255) NOT NULL, rate DOUBLE PRECISION NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE taxes (id INT AUTO_INCREMENT NOT NULL, `label` VARCHAR(255) NOT NULL, rate DOUBLE PRECISION NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, role_id INT NOT NULL, name VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, active TINYINT(1) NOT NULL, hasImage TINYINT(1) NOT NULL, card VARCHAR(255) DEFAULT NULL, INDEX IDX_1483A5E9D60322AC (role_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE roles (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, permissions LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
ALTER TABLE tickets ADD CONSTRAINT FK_54469DF49ED3320C FOREIGN KEY (cashregister_id) REFERENCES cashregisters (id);
ALTER TABLE tickets ADD CONSTRAINT FK_54469DF4A76ED395 FOREIGN KEY (user_id) REFERENCES users (id);
ALTER TABLE tickets ADD CONSTRAINT FK_54469DF49395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id);
ALTER TABLE tickets ADD CONSTRAINT FK_54469DF454EC7A8F FOREIGN KEY (tariffarea_id) REFERENCES tariffareas (id);
ALTER TABLE tickets ADD CONSTRAINT FK_54469DF4E1BC3B58 FOREIGN KEY (discountprofile_id) REFERENCES discountprofiles (id);
ALTER TABLE compositiongroups ADD CONSTRAINT FK_C72568934584665A FOREIGN KEY (product_id) REFERENCES products (id);
ALTER TABLE sessioncustbalances ADD CONSTRAINT FK_9D3CBD8BC914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id);
ALTER TABLE sessioncustbalances ADD CONSTRAINT FK_9D3CBD8B9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id);
ALTER TABLE sessiontaxes ADD CONSTRAINT FK_59DAD7C9C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id);
ALTER TABLE sessiontaxes ADD CONSTRAINT FK_59DAD7C9B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE products ADD CONSTRAINT FK_B3BA5A5A12469DE2 FOREIGN KEY (category_id) REFERENCES categories (id);
ALTER TABLE products ADD CONSTRAINT FK_B3BA5A5AB2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE customers ADD CONSTRAINT FK_62534E21B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE customers ADD CONSTRAINT FK_62534E21E1BC3B58 FOREIGN KEY (discountprofile_id) REFERENCES discountprofiles (id);
ALTER TABLE sessioncats ADD CONSTRAINT FK_F32F3B52C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id);
ALTER TABLE paymentmodereturns ADD CONSTRAINT FK_968A92FABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id);
ALTER TABLE paymentmodereturns ADD CONSTRAINT FK_968A92FCA0BF816 FOREIGN KEY (returnmode_id) REFERENCES paymentmodes (id);
ALTER TABLE places ADD CONSTRAINT FK_FEAF6C55854679E2 FOREIGN KEY (floor_id) REFERENCES floors (id);
ALTER TABLE tariffareaprices ADD CONSTRAINT FK_E1F3B96454EC7A8F FOREIGN KEY (tariffarea_id) REFERENCES tariffareas (id);
ALTER TABLE tariffareaprices ADD CONSTRAINT FK_E1F3B9644584665A FOREIGN KEY (product_id) REFERENCES products (id);
ALTER TABLE tariffareaprices ADD CONSTRAINT FK_E1F3B964B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE compositionproducts ADD CONSTRAINT FK_DA85AC5F976B2F42 FOREIGN KEY (compositiongroup_id) REFERENCES compositiongroups (id);
ALTER TABLE compositionproducts ADD CONSTRAINT FK_DA85AC5F4584665A FOREIGN KEY (product_id) REFERENCES products (id);
ALTER TABLE sessionpayments ADD CONSTRAINT FK_342F815C914703E FOREIGN KEY (cashsession_id) REFERENCES sessions (id);
ALTER TABLE sessionpayments ADD CONSTRAINT FK_342F815ABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id);
ALTER TABLE sessionpayments ADD CONSTRAINT FK_342F81538248176 FOREIGN KEY (currency_id) REFERENCES currencies (id);
ALTER TABLE ticketlines ADD CONSTRAINT FK_20FFE9B5700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id);
ALTER TABLE ticketlines ADD CONSTRAINT FK_20FFE9B54584665A FOREIGN KEY (product_id) REFERENCES products (id);
ALTER TABLE ticketlines ADD CONSTRAINT FK_20FFE9B5B2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE sessions ADD CONSTRAINT FK_9A609D139ED3320C FOREIGN KEY (cashregister_id) REFERENCES cashregisters (id);
ALTER TABLE ticketpayments ADD CONSTRAINT FK_1D56231D700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id);
ALTER TABLE ticketpayments ADD CONSTRAINT FK_1D56231DABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id);
ALTER TABLE ticketpayments ADD CONSTRAINT FK_1D56231D38248176 FOREIGN KEY (currency_id) REFERENCES currencies (id);
ALTER TABLE categories ADD CONSTRAINT FK_3AF34668727ACA70 FOREIGN KEY (parent_id) REFERENCES categories (id);
ALTER TABLE tickettaxes ADD CONSTRAINT FK_AD70C2DB700047D2 FOREIGN KEY (ticket_id) REFERENCES tickets (id);
ALTER TABLE tickettaxes ADD CONSTRAINT FK_AD70C2DBB2A824D8 FOREIGN KEY (tax_id) REFERENCES taxes (id);
ALTER TABLE paymentmodevalues ADD CONSTRAINT FK_4CB607B0ABEEF95F FOREIGN KEY (paymentmode_id) REFERENCES paymentmodes (id);
ALTER TABLE users ADD CONSTRAINT FK_1483A5E9D60322AC FOREIGN KEY (role_id) REFERENCES roles (id);
Supports Markdown
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