diff --git a/docs/update_and_migration/from_3.3/update_from_3.3.md b/docs/update_and_migration/from_3.3/update_from_3.3.md index 15c75314a1..c6ea6571a3 100644 --- a/docs/update_and_migration/from_3.3/update_from_3.3.md +++ b/docs/update_and_migration/from_3.3/update_from_3.3.md @@ -439,6 +439,24 @@ Run the following scripts: psql < vendor/ibexa/installer/upgrade/db/postgresql/ibexa-3.3.33-to-3.3.34.sql ``` +### Ibexa Open Source + +If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply the following database upgrade script: + +=== "MySQL" +``` sql +ALTER TABLE `ezcontentobject_attribute` ADD INDEX `ezcontentobject_attribute_co_id_ver` (`contentobject_id`,`version`); +ALTER TABLE `ezurl_object_link` ADD INDEX `ezurl_ol_coa_id_cav` (`contentobject_attribute_id`,`contentobject_attribute_version`); +ALTER TABLE `ezcontentobject_link` ADD INDEX `ezco_link_cca_id` (`contentclassattribute_id`); +``` + +=== "PostgreSQL" +``` sql +CREATE INDEX "ezco_link_cca_id" O##N "ezcontentobject_link" ("contentclassattribute_id"); +CREATE INDEX "ezcontentobject_attribute_co_id_ver" ON "ezcontentobject_attribute" ("contentobject_id", "version"); +CREATE INDEX "ezurl_ol_coa_id_cav" ON "ezurl_object_link" ("contentobject_attribute_id", "contentobject_attribute_version"); +``` + ### v3.3.40 No additional steps needed. diff --git a/docs/update_and_migration/from_4.1/update_from_4.1.md b/docs/update_and_migration/from_4.1/update_from_4.1.md index db04c3225e..5c9b209e7c 100644 --- a/docs/update_and_migration/from_4.1/update_from_4.1.md +++ b/docs/update_and_migration/from_4.1/update_from_4.1.md @@ -129,7 +129,69 @@ Apply the following database update scripts: #### Ibexa Open Source -If you have no access to [[= product_name =]]'s `ibexa/installer` package, database upgrade isn't necessary. +If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply the following database upgrade script: + +=== "MySQL" +``` sql +CREATE TABLE IF NOT EXISTS ibexa_user_invitations +( + id int auto_increment primary key, + email varchar(255) not null, + site_access_name varchar(255) not null, + hash varchar(255) not null, + creation_date int not null, + used tinyint(1) null, + constraint ibexa_user_invitations_email_uindex + unique (email(191)), + constraint ibexa_user_invitations_hash_uindex + unique (hash(191)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; + +CREATE TABLE IF NOT EXISTS ibexa_user_invitations_assignments +( + id int auto_increment primary key, + invitation_id int not null, + user_group_id int null, + role_id int null, + limitation_type varchar(255) null, + limitation_value varchar(255) null, + constraint ibexa_user_invitations_assignments_ibexa_user_invitations_id_fk + foreign key (invitation_id) references ibexa_user_invitations (id) + on update cascade on delete cascade +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; +``` + +=== "PostgreSQL" +``` sql +CREATE TABLE IF NOT EXISTS ibexa_user_invitations +( + id SERIAL PRIMARY KEY, + email VARCHAR(255) NOT NULL, + site_access_name VARCHAR(255) NOT NULL, + hash VARCHAR(255) NOT NULL, + creation_date INTEGER NOT NULL, + used BOOLEAN DEFAULT false NOT NULL +); + +CREATE UNIQUE INDEX IF NOT EXISTS ibexa_user_invitations_email_uindex + ON ibexa_user_invitations (email); + +CREATE UNIQUE INDEX IF NOT EXISTS ibexa_user_invitations_hash_uindex + ON ibexa_user_invitations (hash); + +CREATE TABLE IF NOT EXISTS ibexa_user_invitations_assignments +( + id SERIAL PRIMARY KEY, + invitation_id INTEGER NOT NULL, + user_group_id INTEGER NULL, + role_id INTEGER NULL, + limitation_type VARCHAR(255) NULL, + limitation_value VARCHAR(255) NULL, + CONSTRAINT ibexa_content_customer_group_attribute_fk + FOREIGN KEY (invitation_id) REFERENCES ibexa_user_invitations (id) + ON UPDATE CASCADE ON DELETE CASCADE +); +``` ## Ensure password safety diff --git a/docs/update_and_migration/from_4.5/update_from_4.5.md b/docs/update_and_migration/from_4.5/update_from_4.5.md index b4b096f723..b48ece9e10 100644 --- a/docs/update_and_migration/from_4.5/update_from_4.5.md +++ b/docs/update_and_migration/from_4.5/update_from_4.5.md @@ -50,6 +50,27 @@ Run the following scripts: psql < vendor/ibexa/installer/upgrade/db/postgresql/ibexa-4.5.1-to-4.5.2.sql ``` +##### Ibexa Open Source + +If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply the following database upgrade script: + +=== "MySQL" +``` sql +ALTER TABLE `ezcontentobject_link` ADD INDEX `ezco_link_cca_id` (`contentclassattribute_id`); +ALTER TABLE `ezcontentclass_attribute` ADD INDEX `ezcontentclass_attr_dts` (`data_type_string`); +ALTER TABLE `ezurl_object_link` ADD INDEX `ezurl_ol_coa_id_cav` (`contentobject_attribute_id`,`contentobject_attribute_version`); +ALTER TABLE `ezcontentobject_attribute` ADD INDEX `ezcontentobject_attribute_co_id_ver` (`contentobject_id`,`version`); +``` + +=== "PostgreSQL" +``` sql +CREATE INDEX "ezco_link_cca_id" ON "ezcontentobject_link" ("contentclassattribute_id"); +CREATE INDEX "ezcontentclass_attr_dts" ON "ezcontentclass_attribute" ("data_type_string"); +CREATE INDEX "ezcontentobject_attribute_co_id_ver" ON "ezcontentobject_attribute" ("contentobject_id", "version"); +CREATE INDEX "ezurl_ol_coa_id_cav" ON "ezurl_object_link" ("contentobject_attribute_id", "contentobject_attribute_version"); +``` + + ### v4.5.3 #### Database update [[% include 'snippets/experience_badge.md' %]] [[% include 'snippets/commerce_badge.md' %]] @@ -193,6 +214,36 @@ Apply the following database update scripts: psql < vendor/ibexa/installer/upgrade/db/postgresql/ibexa-4.5.latest-to-4.6.0.sql ``` +### Ibexa Open Source + +If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply the following database upgrade script: + +=== "MySQL" +``` sql +ALTER TABLE `ibexa_token` + ADD COLUMN `revoked` BOOLEAN NOT NULL DEFAULT false; + +-- Rewrites max file size values from data_int1 to data_float1 column and stores size unit +UPDATE ezcontentclass_attribute +SET data_float1 = CAST(data_int1 AS DOUBLE), data_int1 = NULL, data_text1 = 'MB' +WHERE data_type_string = 'ezimage'; + +UPDATE ezcontentclass_attribute SET is_searchable = 1 WHERE data_type_string = 'ezimage' AND contentclass_id = (SELECT id FROM ezcontentclass WHERE identifier = 'image'); +``` + +=== "PostgreSQL" +``` sql +ALTER TABLE "ibexa_token" + ADD "revoked" BOOLEAN DEFAULT false NOT NULL; + +-- Rewrites max file size values from data_int1 to data_float1 column and stores size unit +UPDATE ezcontentclass_attribute +SET data_float1 = CAST(data_int1 AS DOUBLE PRECISION), data_int1 = NULL, data_text1 = 'MB' +WHERE data_type_string = 'ezimage'; + +UPDATE ezcontentclass_attribute SET is_searchable = 1 WHERE data_type_string = 'ezimage' AND contentclass_id = (SELECT id FROM ezcontentclass WHERE identifier = 'image'); +``` + ### Update [[= product_name_com =]] database [[% include 'snippets/commerce_badge.md' %]] For [[= product_name_com =]] installations, you also need to run the following command line: @@ -277,24 +328,6 @@ php bin/console ibexa:migrations:import vendor/ibexa/order-management/src/bundle php bin/console ibexa:migrations:migrate --file=2023_11_20_14_33_order_dashboard_structure.yaml ``` -### Ibexa Open Source - -If you don't have access to [[= product_name =]]'s `ibexa/installer` package and cannot apply the scripts from `vendor/ibexa/installer` directory, apply the following database update instead: - -=== "MySQL" - - ``` sql - ALTER TABLE `ibexa_token` - ADD COLUMN `revoked` BOOLEAN NOT NULL DEFAULT false; - ``` - -=== "PostgreSQL" - - ``` sql - ALTER TABLE "ibexa_token" - ADD "revoked" BOOLEAN DEFAULT false NOT NULL; - ``` - ## Revisit configuration ### Revisit mandatory configuration diff --git a/docs/update_and_migration/from_4.6/update_from_4.6.md b/docs/update_and_migration/from_4.6/update_from_4.6.md index c7e4898c65..a3aac1b19e 100644 --- a/docs/update_and_migration/from_4.6/update_from_4.6.md +++ b/docs/update_and_migration/from_4.6/update_from_4.6.md @@ -105,6 +105,47 @@ Run the following scripts: psql < vendor/ibexa/installer/upgrade/db/postgresql/ibexa-4.6.3-to-4.6.4.sql ``` +##### Ibexa Open Source + +If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply the following database upgrade script: + +=== "MySQL" +``` sql +-- IBX-6592: The state/assign policy shouldn't utilize neither Location nor Subtree limitations +DELETE l +FROM `ezpolicy_limitation` l +INNER JOIN `ezpolicy` p ON p.id = l.policy_id +WHERE p.function_name = 'assign' + AND p.module_name = 'state' + AND l.identifier IN ('Node', 'Subtree'); + +DELETE lv +FROM `ezpolicy_limitation_value` lv +LEFT JOIN `ezpolicy_limitation` ON `ezpolicy_limitation`.id = lv.limitation_id +WHERE `ezpolicy_limitation`.id IS NULL; +``` + +=== "PostgreSQL" +``` sql +-- IBX-6592: The state/assign policy shouldn't utilize neither Location nor Subtree limitations +DELETE +FROM "ezpolicy_limitation" +WHERE "ezpolicy_limitation".id IN + (SELECT "ezpolicy_limitation".id + FROM "ezpolicy_limitation" + INNER JOIN "ezpolicy" ON "ezpolicy".id = "ezpolicy_limitation".policy_id + WHERE "ezpolicy".function_name = 'assign' + AND "ezpolicy".module_name = 'state' + AND "ezpolicy_limitation".identifier IN ('Node', 'Subtree')); +DELETE +FROM "ezpolicy_limitation_value" +WHERE "ezpolicy_limitation_value".id IN + (SELECT "ezpolicy_limitation_value".id + FROM "ezpolicy_limitation_value" + LEFT JOIN "ezpolicy_limitation" ON "ezpolicy_limitation".id = "ezpolicy_limitation_value".limitation_id + WHERE "ezpolicy_limitation".id IS NULL); +``` + ## v4.6.8 To avoid deprecations when updating from an older PHP version to PHP 8.2 or 8.3, run the following commands: