Skip to content

Standardize collection names #12

Closed

Description

@engelgabriel

All to lowercase, and remove data. prefix

Activity

  1. added this to the milestone on Jul 1, 2015
  2. modified the milestones: , on Jul 1, 2015
  3. rwakida commented on Jul 9, 2015

    @rwakida
    Contributor

    Questions:

    1. Does data.ChatRoom becomes chat_room or chatroom?
    2. Any other collections besides: data.ChatMessage, data.ChatRoom, data.ChatSubscription, and data.ChatTyping?
    3. Does the solution need to migrate existing data? Meteor doesn't support renaming or deleting a collection as far as I know. Any suggestions?
  4. sampaiodiego commented on Jul 9, 2015

    @sampaiodiego
    Member

    I was thinking in to use a prefic like "rocket" for collection names. should be one of these:

    • rocket.chatRoom, rocket.chatMessage, rocket.chatSubscription, ...
    • rocketRoom, rocketMessage, rocketSubscription, ...

    I think using a prefix is the best for an existing database with other collections.

    What do you others think?

  5. engelgabriel commented on Jul 10, 2015

    @engelgabriel
    MemberAuthor

    I think we should either lose the prefix all together.. and use

    • rooms
    • messages
    • subscriptions

    or

    • rocketchat_rooms
    • rocketchat_messages
    • rocketchat_subscriptions
  6. rwakida commented on Jul 11, 2015

    @rwakida
    Contributor

    As an outsider learning the system, the prefix helps to differentiate Rocket.Chat's collections from non-Rocket.Chat collections. I like rocketchat_rooms format.

    What about existing data migration?

  7. rodrigok commented on Jul 11, 2015

    @rodrigok
    Member

    I agree with @rwakida.

    About the data migration we already use one lib to do migrations, you can see here (https://github.com/RocketChat/Rocket.Chat/tree/master/server/startup/migrations)

  8. rwakida commented on Jul 11, 2015

    @rwakida
    Contributor

    Thanks @rodrigok. I saw the migrations, but I think this is a special case. Meteor (from what I know) doesn't support Mongo's renameCollection or drop collection. So we either have to:

    1. Instruct the user to manually run renameCollection from the shell before starting meteor.
      or
    2. Rename the collections in collections.coffee. Create a migration that accesses the old collections and migrates the data to the new collections.

    The first option is clean, but requires user intervention. The second option is user-friendly, but leaves the old collections and the user has to manually drop the old collections.

    A Google search suggested using a Node package that provides shell access, but only works when NOT using the embedded MongoDB.

    I'm relatively new to Meteor so please excuse me if I missed something.

  9. sampaiodiego commented on Jul 11, 2015

    @sampaiodiego
    Member

    @rodrigok but using meteor could be painful since you can't rename collections

  10. 1 remaining item

  11. added a commit that references this issue on Jul 17, 2015
    165ca37
  12. added a commit that references this issue on Jul 17, 2015
    f12ce2c
  13. marceloschmidt commented on Jul 17, 2015

    @marceloschmidt
    Member

    I have merged this PR, but I think we should also change the names of "settings" and "migrations" collections. Also, rename "userSessions" to "user_sessions".

  14. rwakida commented on Jul 17, 2015

    @rwakida
    Contributor

    Hi @marceloschmidt. Sorry, I missed those collections. I noticed you added the "in Progress" label. Does that mean you're taking over and renaming the settings, migrations, and userSessions collections?

  15. engelgabriel commented on Jul 18, 2015

    @engelgabriel
    MemberAuthor

    Thanks for the work @rwakida, you did a great job. @marceloschmidt just labeled as in progress so we know that is half done. Having said, I am not sure you'd have access to control the name of all those collection from our repository. Some are 3rd party packages, other are made by us, but in other repositories... you can give it a try and let us know.

  16. rwakida commented on Jul 18, 2015

    @rwakida
    Contributor

    Thanks and great job on Rocket.Chat!

    @engelgabriel @marceloschmidt I did a quick search and found that settings and oembed_cache are under Rocket.Chat control. I added both to the v9 migration and created a new pull request.

  17. added a commit that references this issue on Jul 18, 2015
  18. marceloschmidt commented on Jul 19, 2015

    @marceloschmidt
    Member

    Thank you very much @rwakida

  19. added a commit that references this issue on Sep 26, 2016
  20. added a commit that references this issue on Jul 10, 2018
  21. added a commit that references this issue on Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions