mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-27 18:48:50 -04:00
Add Guards to Database Migration (#4571)
* Properly replace key in config file when encryption key is updated This fixes a break caused if there is a commented out key in the .env. It's a more robust replacement. Signed-off-by: objec <objecttothis@gmail.com> * Guard against dropping constraint that doesn't exist - Updated wording in migration_helper.php PHPdoc - Use migration_helper function to drop key which only drops the constraint if it exists. The core logic was not changed here. It only adds a safety mechanism. Signed-off-by: objec <objecttothis@gmail.com> * Remove duplicate call to getResultArray in attribute_links loop Signed-off-by: objec <objecttothis@gmail.com> * PSR refactoring Signed-off-by: objec <objecttothis@gmail.com> * Remove dead parameter from reassignDuplicateAttributeValues method The attribute value was not needed and is never used since we have the attribute_ids and those are unique. Signed-off-by: objec <objecttothis@gmail.com> * Create potentially missing primary keys before attempting to add constraints. Signed-off-by: objec <objecttothis@gmail.com> * Guard datetime creation Signed-off-by: objec <objecttothis@gmail.com> * Update regex pattern to handle double-quoted and non-quoted encryption keys Signed-off-by: objec <objecttothis@gmail.com> * Issue warning and fallback on unparseable attribute_date during Signed-off-by: objec <objecttothis@gmail.com> --------- Signed-off-by: objec <objecttothis@gmail.com>
This commit is contained in:
1 parent
4173d7f350
commit
450c0866b5
4 files changed
+77
-66
No files matched your search
@@ -11,10 +11,6 @@ ALTER TABLE `ospos_attribute_definitions` ADD INDEX(`definition_type`);
|
||||
ALTER TABLE `ospos_cash_up` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
|
||||
#ospos_customers table
|
||||
ALTER TABLE `ospos_customers` DROP FOREIGN KEY `ospos_customers_ibfk_1`;
|
||||
ALTER TABLE `ospos_customers_points` DROP FOREIGN KEY `ospos_customers_points_ibfk_1`;
|
||||
ALTER TABLE `ospos_sales` DROP FOREIGN KEY `ospos_sales_ibfk_2`;
|
||||
|
||||
ALTER TABLE `ospos_customers` MODIFY `taxable` tinyint(1) DEFAULT 1 NOT NULL;
|
||||
ALTER TABLE `ospos_customers` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE `ospos_customers` MODIFY `discount_type` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
@@ -31,16 +27,6 @@ ALTER TABLE `ospos_dinner_tables` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL
|
||||
ALTER TABLE `ospos_dinner_tables` ADD INDEX(`status`);
|
||||
|
||||
#ospos_employees table
|
||||
ALTER TABLE `ospos_sales_payments` DROP FOREIGN KEY `ospos_sales_payments_ibfk_2`;
|
||||
ALTER TABLE `ospos_sales` DROP FOREIGN KEY `ospos_sales_ibfk_1`;
|
||||
ALTER TABLE `ospos_receivings` DROP FOREIGN KEY `ospos_receivings_ibfk_1`;
|
||||
ALTER TABLE `ospos_inventory` DROP FOREIGN KEY `ospos_inventory_ibfk_2`;
|
||||
ALTER TABLE `ospos_grants` DROP FOREIGN KEY `ospos_grants_ibfk_2`;
|
||||
ALTER TABLE `ospos_expenses` DROP FOREIGN KEY `ospos_expenses_ibfk_2`;
|
||||
ALTER TABLE `ospos_employees` DROP FOREIGN KEY `ospos_employees_ibfk_1`;
|
||||
ALTER TABLE `ospos_cash_up` DROP FOREIGN KEY `ospos_cash_up_ibfk_1`;
|
||||
ALTER TABLE `ospos_cash_up` DROP FOREIGN KEY `ospos_cash_up_ibfk_2`;
|
||||
|
||||
ALTER TABLE `ospos_employees` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE `ospos_employees` MODIFY `hash_version` tinyint(1) DEFAULT 2 NOT NULL;
|
||||
|
||||
@@ -67,7 +53,6 @@ ALTER TABLE `ospos_expense_categories` ADD INDEX(`category_description`);
|
||||
ALTER TABLE `ospos_giftcards` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
|
||||
#ospos_items table
|
||||
ALTER TABLE `ospos_items` DROP FOREIGN KEY `ospos_items_ibfk_1`;
|
||||
ALTER TABLE `ospos_items` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE `ospos_items` MODIFY `stock_type` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE `ospos_items` MODIFY `item_type` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
@@ -112,10 +97,6 @@ ALTER TABLE `ospos_sessions` ADD INDEX(`ip_address`);
|
||||
ALTER TABLE `ospos_stock_locations` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
|
||||
#ospos_suppliers table
|
||||
ALTER TABLE `ospos_expenses` DROP FOREIGN KEY `ospos_expenses_ibfk_3`;
|
||||
ALTER TABLE `ospos_receivings` DROP FOREIGN KEY `ospos_receivings_ibfk_2`;
|
||||
ALTER TABLE `ospos_suppliers` DROP FOREIGN KEY `ospos_suppliers_ibfk_1`;
|
||||
|
||||
ALTER TABLE `ospos_suppliers` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE `ospos_suppliers` MODIFY `category` tinyint(1) NOT NULL;
|
||||
ALTER TABLE `ospos_suppliers` ADD INDEX(`category`);
|
||||
|
||||
Reference in new issue
Block a user