Migrating CBSubs data with modifications

4 years 10 months ago - 4 years 10 months ago #312209 by boyjahq
I have a site that uses Joomla 2.5.28, Community Builder 1.9.1 and CBSubs 3.0.0. I have built a new site from scratch that I will migrate information to. I have created scripts that will modify most Joomla tables and Comprofiler to the new system (modifying user group numbers to match those of the new site, modifying Comprofiler fields and data to match the new format, etc.). I must do the same with CBSubs data, which in itself is a daunting task, but it is made even more difficult because in the old site we had 36 different subscription plans and in the new site this is reduced to one plan. My thought was to convert all members from the old site to that one plan by simply modifying each record from the old website, which contain reference to a plan number, to the new plan number on the new site. I would keep subscription expiration dates and all other information the same.

Is this viable? Is there a better way to handle this?

Please Log in to join the conversation.

4 years 10 months ago - 4 years 10 months ago #312213 by krileon
Replied by krileon on topic Migrating CBSubs data with modifications
Probably the easiest way to move subscriptions is to use the CBSubs Import feature to import your users into your new plan. It supports more advanced modes where you can supply their subscription date. Expiration date will calculate automatically based off the plans duration.

If you need the full previous payment history you have to go through the painful process of updating most of CBSubs tables to point to your new plan.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: boyjahq

Please Log in to join the conversation.

4 years 10 months ago - 4 years 10 months ago #312222 by boyjahq
Replied by boyjahq on topic Migrating CBSubs data with modifications
I have looked into the CBSubs Import feature and I have a couple of questions/suggestions, particularly when migrating data from an existing system:

1) There is no indication in the documentation that the data needed for CBSubs import comes from the data table cbsubs_subscriptions. While possibly obvious to some, it would still be valuable to say that in the documentation. It removes one more level of doubt and lots of searching around to figure it out.

2) The order of columns in the database (for those items needed for CBSubs import) is:

status,user_id,plan_id,subscription_date

And when we export that data from the database, that is the order in which the CSV file puts the data.

However, in CBSubs import, it requires that the data be in the order:

user_id,plan_id,status,subscription_date

In the actual data table, status is the first column. For the import function, status must be the 3rd column.

It would be more logical and less time consuming if the import order was identical to the order in which data is exported. Perhaps there is some reason why the order of columns is different, but if there is no particular reason, it would be nice if the order of columns was identical.

3) The text on the import page seems to indicate that we need to rename column headings from:
user_id,plan_id,status,subscription_date

To:
userid,planid,statusSingleChar,SubscriptionDateISO

However doing so results in an error upon import. It seems that the actual format for the import file requires NO field names in the first row of the CSV import file. Please add this to the documentation and to the instruction text that appears on the CBSubs import page.

4) In the end, even if I make all adjustments as specified above, when I try to import, whether as for testing purposes or for actual import, I repeatedly get the error:
The error is: “unknown error” (NSURLErrorDomain:-1)

Please advise how to overcome this error.

Please Log in to join the conversation.

4 years 10 months ago #312227 by krileon
Replied by krileon on topic Migrating CBSubs data with modifications

1) There is no indication in the documentation that the data needed for CBSubs import comes from the data table cbsubs_subscriptions. While possibly obvious to some, it would still be valuable to say that in the documentation. It removes one more level of doubt and lots of searching around to figure it out.

It doesn't matter where the data comes from as long as it's properly structured to fit the import requirements.

2) The order of columns in the database (for those items needed for CBSubs import) is:

status,user_id,plan_id,subscription_date

And when we export that data from the database, that is the order in which the CSV file puts the data.

However, in CBSubs import, it requires that the data be in the order:

user_id,plan_id,status,subscription_date

In the actual data table, status is the first column. For the import function, status must be the 3rd column.

It would be more logical and less time consuming if the import order was identical to the order in which data is exported. Perhaps there is some reason why the order of columns is different, but if there is no particular reason, it would be nice if the order of columns was identical.

Format your select query to be in the correct order then export the results. This is doable using phpmyadmin if you're exporting existing entries in the database. Example as follows.

SELECT `user_id`, `plan_id`, `status`, `subscription_date` FROM `jos_cbsubs_subscriptions`

3) The text on the import page seems to indicate that we need to rename column headings from:
user_id,plan_id,status,subscription_date

To:
userid,planid,statusSingleChar,SubscriptionDateISO

You don't rename anything. The database columns are irrelevant. You're just providing the data. 1 subscription per line. Example as follows.

63,1,A,2009-01-01 00:00:00
86,1,A,2009-02-01 00:00:00
92,1,A,2008-04-01 00:00:00
64,1,A,2009-05-01 00:00:00
71,1,A,2007-03-01 00:00:00

All of those users would be subscribed to the plan with an ID of 1. Their subscriptions initial status is A for Active. Their subscription dates are provided for when their subscription became active. Expiration is calculated based off the duration of the plan.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.215 seconds

Facebook Twitter LinkedIn