Skip to content

Instantly share code, notes, and snippets.

@merqlove
Last active June 8, 2016 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merqlove/419f70b8255f091d4b5757a56c1e7c2c to your computer and use it in GitHub Desktop.
Save merqlove/419f70b8255f091d4b5757a56c1e7c2c to your computer and use it in GitHub Desktop.
Joomla K2 2.x migrate to Native Joomla 2.5
INSERT INTO lgcp8_categories (id, title, alias, parent_id, published, access, description, language, created_user_id, modified_user_id, metadesc, metakey, metadata, params, extension) SELECT id+1000, name, alias, CASE WHEN parent = 0 THEN 1 ELSE parent+1000 END, published, access, description, language, 996, 0, name, name, "{}", "{\"category_layout\":\"\",\"image\":\"\"}", "com_content" FROM lgcp8_k2_categories
INSERT INTO `lgcp8_content` (`id`, `title`, `state`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `publish_up`, `publish_down`, `access`, `language`, images, urls, attribs, metadata, xreference, metakey, metadesc) SELECT `id`+1000, `title`, CASE WHEN `trash` = 0 THEN 1 ELSE -2 END, `alias`, CASE WHEN `catid` = 0 THEN 1 ELSE `catid`+1000 END, `introtext`, `fulltext`, `created`, `created_by`, `publish_up`, `publish_down`, `access`, `language`, "{}", "{}", "{}", `metadata`, "", `metakey`, `metadesc` FROM `lgcp8_k2_items`
UPDATE lgcp8_content content, (
SELECT x.itemID, GROUP_CONCAT(t. name SEPARATOR ', ') AS 'names'
FROM lgcp8_k2_tags AS t
INNER JOIN lgcp8_k2_tags_xref AS x ON(t.id = x.tagID)
GROUP BY x.itemID
) AS tags_lookup
SET content.metakey = tags_lookup. names
WHERE tags_lookup.itemID = (content.id - 1000) AND content.id > 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment