Skip to content

Commit 4521cdb

Browse files
committed
update_from_4.3_new_commerce.md: Drop old tables: MySQL query
1 parent 086be4b commit 4521cdb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,35 @@ Apply the following database update scripts:
318318
psql <database_name> < vendor/ibexa/installer/upgrade/db/postgresql/commerce/ibexa-4.3.latest-to-4.4.0.sql
319319
```
320320

321+
If you used old Commerce packages before, and have migrated everything, you can remove the old tables.
322+
The removable table are prefixed with `ses_` and `sve_`.
323+
324+
=== "MySQL"
325+
326+
To list the removable tables:
327+
``` sql
328+
SHOW TABLES FROM `<database_name>` WHERE `Tables_in_<database_name>` LIKE 'ses_%' OR `Tables_in_<database_name>` LIKE 'sve_%';
329+
```
330+
331+
To build a query to drop all those tables and execute it as a statement:
332+
``` sql
333+
SELECT CONCAT('DROP TABLE ', GROUP_CONCAT('`', `table_schema`, '`.`', `table_name`, '`' SEPARATOR ', '))
334+
INTO @drop_query
335+
FROM `information_schema`.`tables`
336+
WHERE `table_schema` = '<database_name>' AND (`table_name` LIKE 'ses_%' OR `table_name` LIKE 'sve_%')
337+
;
338+
339+
PREPARE drop_stmt FROM @drop_query;
340+
EXECUTE drop_stmt;
341+
DEALLOCATE PREPARE drop_stmt;
342+
```
343+
344+
=== "PostgreSQL"
345+
346+
```sql
347+
TODO
348+
```
349+
321350
#### Ibexa Open Source
322351

323352
If you have no access to Ibexa DXP's `ibexa/installer` package, database upgrade is not necessary.

0 commit comments

Comments
 (0)