DG
Reported
i cant post sales and delete orders in pos sales, and sales dont show up in dasboard.
i have downloaded and uploaded the update, but i am still have error in the pos sale, also i can not delete an order. please see screen recording https://share.zight.com/E0uv1Nro . i need a fix this is urgent
i have downloaded and uploaded the update, but i am still have error in the pos sale, also i can not delete an order. please see screen recording https://share.zight.com/E0uv1Nro . i need a fix this is urgent
- MSAnsweredHello,
Column `company_id` has been removed from all tables. Please try run the following queries after selecting you database
```sql
-- allow long concatenated statements
SET SESSION group_concat_max_len = 8192;
-- drop foreign keys that involve company_id
SET @drop_fk := (
SELECT GROUP_CONCAT(
CONCAT('ALTER TABLE `', TABLE_SCHEMA, '`.`', TABLE_NAME,
'` DROP FOREIGN KEY `', CONSTRAINT_NAME, '`;')
SEPARATOR ' '
)
FROM information_schema.KEY_COLUMN_USAGE
WHERE COLUMN_NAME = 'company_id'
AND CONSTRAINT_SCHEMA = DATABASE()
AND REFERENCED_TABLE_NAME IS NOT NULL
);
SELECT @drop_fk; -- inspect before running
PREPARE fk_stmt FROM @drop_fk;
EXECUTE fk_stmt;
DEALLOCATE PREPARE fk_stmt;
-- drop secondary indexes that still reference company_id
SET @drop_idx := (
SELECT GROUP_CONCAT(
CONCAT('ALTER TABLE `', TABLE_SCHEMA, '`.`', TABLE_NAME,
'` DROP INDEX `', INDEX_NAME, '`;')
SEPARATOR ' '
)
FROM information_schema.STATISTICS
WHERE COLUMN_NAME = 'company_id'
AND TABLE_SCHEMA = DATABASE()
AND INDEX_NAME 'PRIMARY'
);
SELECT @drop_idx;
PREPARE idx_stmt FROM @drop_idx;
EXECUTE idx_stmt;
DEALLOCATE PREPARE idx_stmt;
-- drop the company_id column wherever it exists
SET @drop_col := (
SELECT GROUP_CONCAT(
CONCAT('ALTER TABLE `', TABLE_SCHEMA, '`.`', TABLE_NAME,
'` DROP COLUMN `company_id`;')
SEPARATOR ' '
)
FROM information_schema.COLUMNS
WHERE COLUMN_NAME = 'company_id'
AND TABLE_SCHEMA = DATABASE()
);
SELECT @drop_col;
PREPARE col_stmt FROM @drop_col;
EXECUTE col_stmt;
DEALLOCATE PREPARE col_stmt;
-- finally drop the companies table if present
DROP TABLE IF EXISTS `companies`;
```
If you still have issues, please let me know your server details in private reply.
Thank you - Login to Reply