summaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-22 14:21:13 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-22 14:21:13 +0100
commit0de84de2e9d7a03077c8e8e1065abf13432c23c9 (patch)
treea554def9463c7d34604752ce8db163bf401aeb93 /admin
parentf3233190e72af1a64f4a345c96611925872bfe26 (diff)
downloadcontact-0de84de2e9d7a03077c8e8e1065abf13432c23c9.tar.gz
contact-0de84de2e9d7a03077c8e8e1065abf13432c23c9.tar.bz2
contact-0de84de2e9d7a03077c8e8e1065abf13432c23c9.zip
Migrate contact xref to liberty_xref tables; add package-owned gallery view
ContactXref and ContactXrefType become thin subclasses of their liberty counterparts, scoped to content_type_guid='contact'. load_emails.php updated to query liberty_xref. Gallery view template moved into contact package as fisheye_fixed_grid_contact.tpl (keeps fisheye clean; same pattern for future assembly/component packages). contact/admin/upgrades/5.0.1.php migrates existing contact_xref_* data into liberty_xref_* tables. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'admin')
-rw-r--r--admin/upgrades/5.0.1.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/admin/upgrades/5.0.1.php b/admin/upgrades/5.0.1.php
new file mode 100644
index 0000000..538e498
--- /dev/null
+++ b/admin/upgrades/5.0.1.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @package contact
+ */
+
+global $gBitInstaller;
+
+$gBitInstaller->registerPackageUpgrade(
+ [
+ 'package' => 'contact',
+ 'version' => '5.0.1',
+ 'description' => 'Migrate contact_xref_type, contact_xref_source and contact_xref data into liberty_xref tables with content_type_guid=\'contact\'.',
+ ],
+ [
+ [ 'QUERY' => [
+ 'SQL92' => [
+ // contact_xref_type: integer xref_type becomes sort_order; text source becomes the xref_type key
+ "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type`
+ (`xref_type`, `content_type_guid`, `title`, `sort_order`, `role_id`, `type_href`)
+ SELECT
+ `source`, 'contact', `title`, `xref_type`, `role_id`, `type_href`
+ FROM `" . BIT_DB_PREFIX . "contact_xref_type`",
+
+ // contact_xref_source: integer xref_type joined to get the text key
+ "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source`
+ (`source`, `content_type_guid`, `xref_type`, `cross_ref_title`, `multi`, `role_id`, `cross_ref_href`, `template`, `data`)
+ SELECT
+ cs.`source`, 'contact', ct.`source`, cs.`cross_ref_title`, cs.`multi`, cs.`role_id`, cs.`cross_ref_href`, cs.`template`, cs.`data`
+ FROM `" . BIT_DB_PREFIX . "contact_xref_source` cs
+ JOIN `" . BIT_DB_PREFIX . "contact_xref_type` ct ON cs.`xref_type` = ct.`xref_type`",
+
+ // contact_xref: direct column mapping, xref_id preserved
+ "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref`
+ (`xref_id`, `content_id`, `source`, `xorder`, `xref`, `xkey`, `xkey_ext`, `data`, `start_date`, `last_update_date`, `entry_date`, `end_date`)
+ SELECT
+ `xref_id`, `content_id`, `source`, `xorder`, `xref`, `xkey`, `xkey_ext`, `data`, `start_date`, `last_update_date`, `entry_date`, `end_date`
+ FROM `" . BIT_DB_PREFIX . "contact_xref`",
+ ],
+ ]],
+ ]
+);