Skip to content
51 changes: 51 additions & 0 deletions docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,57 @@
psql <database_name> < vendor/ibexa/installer/upgrade/db/postgresql/commerce/ibexa-4.3.latest-to-4.4.0.sql
```

If you used old Commerce packages before, and have migrated everything, you can remove the old tables.
The removable table are prefixed with `ses_` and `sve_`.

=== "MySQL"

To list the removable tables:
``` sql
SHOW TABLES FROM `<database_name>` WHERE `Tables_in_<database_name>` LIKE 'ses_%' OR `Tables_in_<database_name>` LIKE 'sve_%';
```

To build a query to drop all those tables and execute it as a statement:
``` sql
SELECT CONCAT('DROP TABLE ', GROUP_CONCAT('`', `table_schema`, '`.`', `table_name`, '`' SEPARATOR ', '))
INTO @drop_query
FROM `information_schema`.`tables`
WHERE `table_schema` = '<database_name>' AND (`table_name` LIKE 'ses_%' OR `table_name` LIKE 'sve_%')
;

Check warning on line 338 in docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md#L338

[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md", "range": {"start": {"line": 338, "column": 1}}}, "severity": "WARNING"}
PREPARE drop_stmt FROM @drop_query;
EXECUTE drop_stmt;
DEALLOCATE PREPARE drop_stmt;
```

=== "PostgreSQL"

```sql
SHOW TABLES FROM <database_name> WHERE Tables_in_<database_name> LIKE 'ses_%' OR Tables_in_<database_name> LIKE 'sve_%';
```

```sql
FOR table_row IN

Check warning on line 351 in docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md#L351

[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md", "range": {"start": {"line": 351, "column": 21}}}, "severity": "WARNING"}
SELECT
table_schema,
table_name
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
AND
table_schema = '<database_name>'
AND
(
table_name LIKE ('ses_%')
OR
table_name LIKE ('sve_%')
)

Check warning on line 366 in docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md#L366

[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/update_and_migration/from_4.3/update_from_4.3_new_commerce.md", "range": {"start": {"line": 366, "column": 10}}}, "severity": "WARNING"}
LOOP
EXECUTE 'DROP TABLE ' || table_row.table_schema || '.' || table_row.table_name;
END LOOP;
```

#### Ibexa Open Source

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