Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] migration from members to auth #4

Closed
jadwigo opened this issue Jun 8, 2017 · 8 comments
Closed

[RFC] migration from members to auth #4

jadwigo opened this issue Jun 8, 2017 · 8 comments

Comments

@jadwigo
Copy link
Contributor

jadwigo commented Jun 8, 2017

If you have a website that had the Members extension and you want to replace that extension with the Auth extension you will need to update the database to make everything happen smoothly.

On mysql you can probably perform the following queries in your bolt database:

ALTER TABLE `bolt_members_account` RENAME TO  `bolt_auth_account` ;
ALTER TABLE `bolt_members_account_meta` RENAME TO  `bolt_auth_account_meta` ;
ALTER TABLE `bolt_members_oauth` RENAME TO  `bolt_auth_oauth` ;
ALTER TABLE `bolt_members_provider` RENAME TO  `bolt_auth_provider` ;
ALTER TABLE `bolt_members_token` RENAME TO  `bolt_auth_token` ;

But not all servers might support RENAME TO
And after that the schema needs to be updated too.

Is it possible to make this happen automagically?

@SvanteRichter
Copy link
Collaborator

SvanteRichter commented Jun 8, 2017 via email

@jadwigo
Copy link
Contributor Author

jadwigo commented Jun 8, 2017

Hmm.. I'm finding out about the not a drop in replacement at the moment too ...

Maybe a list of common things that need to change somewhere.

Stuff like is_member() that needs to be renamed to is_auth()
And member() to auth(), member_meta() to auth_meta()

@SvanteRichter
Copy link
Collaborator

The procedure is basically: "Is it called member? change it to auth."

I thought it best to be consistent with the renaming, so I renamed all the things.

@SvanteRichter
Copy link
Collaborator

SvanteRichter commented Jun 12, 2017

@jadwigo I've been thinking about this one. There is no way for us to automatically fix all of these things, and even if we could fix db tables, config and templates via some god-awful regex or some other method that'd still leave any extensions that depend on the old namespaces and so on.

I'd rather view this as a "spiritual continuation" sort of thing, not a drop-in replacement, and half-assing the migration (only updating the db tables) does not seem productive to me. I'd be very happy to have that SQL in the docs though, it just seems to me like automating it is setting up expectations we won't meet. Does that make sense to you?

@jadwigo
Copy link
Contributor Author

jadwigo commented Jun 13, 2017

Yes it makes sense... automating it would probably mean also creating a transpiler for members-addon extensions or something like that.

Maybe a "migrating_from_members.md" in the documentation that outlines the steps you need to do would do the trick.

@SvanteRichter
Copy link
Collaborator

Yep, gonna put that together before I tag :) I'mma keep this issue around to remind me to do it

@GwendolenLynch
Copy link
Contributor

GwendolenLynch commented Jun 16, 2017

For PostgreSQL you need:

ALTER TABLE bolt_members_account RENAME TO bolt_auth_account;
ALTER TABLE bolt_members_account_meta RENAME TO bolt_auth_account_meta;
ALTER TABLE bolt_members_oauth RENAME TO bolt_auth_oauth;
ALTER TABLE bolt_members_provider RENAME TO bolt_auth_provider;
ALTER TABLE bolt_members_token RENAME TO bolt_auth_token;

ALTER SEQUENCE bolt_members_account_id_seq RENAME TO bolt_auth_account_id_seq;
ALTER SEQUENCE bolt_members_account_meta_id_seq RENAME TO bolt_auth_account_meta_id_seq;
ALTER SEQUENCE bolt_members_oauth_id_seq RENAME TO bolt_auth_oauth_id_seq;
ALTER SEQUENCE bolt_members_provider_id_seq RENAME TO bolt_auth_provider_id_seq;
ALTER SEQUENCE bolt_members_token_id_seq RENAME TO bolt_auth_token_id_seq;

@SvanteRichter
Copy link
Collaborator

SvanteRichter commented Jun 17, 2017

I've added a page in the docs for this, if there is anything else that you feel should go there please an issue or PR in the docs repo! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants