brewman/Conversion/SqliteDB.txt

19 lines
1.4 KiB
Plaintext
Raw Normal View History

UPDATE entities_vouchers SET date = date || ".000000", lasteditdate = lasteditdate || ".000000", creationdate = creationdate || ".000000";
UPDATE entities_attendances SET date = date || ".000000", creationdate = creationdate || ".000000";
UPDATE entities_fingerprints SET date = date || ".000000";
ALTER TABLE "Entities_Batches" RENAME TO "Entities_Batches_old";
CREATE TABLE "Entities_Batches" ("BatchID" guid NOT NULL ,"Name" nvarchar(50) NOT NULL ,"ProductID" guid,"QuantityRemaining" numeric NOT NULL ,"Rate" numeric NOT NULL ,"Tax" numeric NOT NULL ,"Discount" numeric NOT NULL, PRIMARY KEY ([BatchID]));
INSERT INTO "Entities_Batches" SELECT "BatchID","Name","ProductID","QuantityRemaining","Rate","Tax","Discount" FROM "Entities_Batches_old";
DROP TABLE "Entities_Batches_old";
ALTER TABLE "Entities_Ledgers" RENAME TO "Entities_Ledgers_old";
CREATE TABLE "Entities_Ledgers" ("LedgerID" guid NOT NULL, "Code" integer NOT NULL, "Name" nvarchar(255) NOT NULL COLLATE NOCASE, "Type" integer NOT NULL, "ledger_type" nvarchar(50) NOT NULL, "IsActive" bit NOT NULL, "CostCenterID" guid,
PRIMARY KEY ([LedgerID]),
FOREIGN KEY ([CostCenterID]) REFERENCES [Entities_CostCenters]([CostCenterID])
);
INSERT INTO "Entities_Ledgers" SELECT "LedgerID", "Code", "Name", "Type", '', "IsActive", "CostCenterID" FROM "Entities_Ledgers_old";
UPDATE "Entities_Ledgers" SET ledger_type = 'employees' where type = 10;
DROP TABLE "Entities_Ledgers_old";