Skip to content

Commit 92821db

Browse files
committed
More details on moving organizations
1 parent 073af09 commit 92821db

File tree

1 file changed

+83
-30
lines changed

1 file changed

+83
-30
lines changed

docs/development/design/organizations.rst

+83-30
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ we only support individual accounts.
88
Several integrations that we support have organizations,
99
where users group their repositories.
1010

11-
Why support organizations in the community site?
12-
------------------------------------------------
11+
Why move organizations in the community site?
12+
---------------------------------------------
1313

1414
We support organizations in the commercial site,
1515
having no organizations in the community site makes the code maintenance difficult.
@@ -20,39 +20,22 @@ Users from the community site can have organizations in external sites from wher
2020
Currently users have all projects from different organizations in their account.
2121
Having not a clear way to group/separate those.
2222

23+
There is also a product decision.
24+
Supporting organizations only on code,
25+
but enable the feature only on the commercial site.
26+
2327
How are we going to support organizations?
2428
------------------------------------------
2529

26-
Currently users can have several projects.
27-
With organizations we have two paths:
28-
29-
#. Support users and organizations to own projects
30-
#. Support only organizations to own projects
31-
32-
With 1, the migration process would be straightforward for the community site.
33-
With 2, the migration process would be straightforward for the commercial site.
34-
35-
How to migrate current projects
36-
-------------------------------
37-
38-
If we choose to go with the second option from :ref:`development/design/organizations:How are we going to support organizations?`
39-
we'll need to define a migration plan,
40-
like creating an organization for all current projects.
30+
Currently only users can own projects.
31+
With organizations this is going to change to:
32+
Users and organizations can own projects.
4133

42-
But, for whatever option we choose,
43-
we'll need to move the models defined in the corporate site
44-
to the community site.
34+
With this, the migration process would be straightforward for the community site.
4535

46-
From the technical site
47-
~~~~~~~~~~~~~~~~~~~~~~~
48-
49-
We should start by removing unused features and dead code from the organizations in the corporate site,
50-
and isolate/separate the models to be moved from the ones that aren't going to be moved.
51-
After that, it should be more easy to move the organizations *app* (or part of it)
52-
to the community site (and not changes in table names would be required).
53-
54-
Additionally, we are going to need to edit the current querysets, modify/add UI elements,
55-
and add new endpoints to the API (v3 only).
36+
For the commercial site we still have a decision.
37+
Are we going to support users and organizations to own projects?
38+
Or just organizations?
5639

5740
What features of organizations are we going to support?
5841
-------------------------------------------------------
@@ -77,6 +60,68 @@ So, we should only support admin permissions for teams.
7760
Subscriptions, this is only valid for the corporate site,
7861
since we don't charge for use in the community site.
7962

63+
How to migrate current projects
64+
-------------------------------
65+
66+
Since we are not replacing the current implementation,
67+
we don't need to migrate current projects from the community site nor from the corporate site.
68+
69+
How to migrate the organizations app
70+
------------------------------------
71+
72+
The migration can be split in:
73+
74+
#. Remove/simplify code from the migrations app on the corporate site.
75+
#. Isolate/separate models and code that isn't going to be moved.
76+
#. Start by moving the models, managers, and figure out how to handle migrations.
77+
#. Move the rest of the code as needed.
78+
#. Activate organizations app on the community site.
79+
#. Integrate the code from the community site to the new code.
80+
81+
We should start by removing unused features and dead code from the organizations in the corporate site,
82+
and simplify existing code if possible (some of this was already done).
83+
84+
Isolate/separate the models to be moved from the ones that aren't going to be moved.
85+
We should move the models that aren't going to me moved to another app.
86+
87+
- Plan
88+
- PlanFeature
89+
- Subscription
90+
91+
This app can be named *subscriptions*.
92+
We can get around the table names and migrations by setting the explicitly the table name to `organizations_<model>`,
93+
and doing a fake migration.
94+
Following suggestions in https://stackoverflow.com/questions/48860227/moving-multiple-models-from-one-django-app-to-another.
95+
Code related to subscriptions should be moved out from the organizations app.
96+
97+
After that, it should be more easy to move the organizations *app* (or part of it)
98+
to the community site (and not changes in table names would be required).
99+
100+
We start by moving the models.
101+
102+
- Organization
103+
- OrganizationOwner
104+
- Team
105+
- TeamInvite
106+
- TeamMember
107+
108+
Migrations aren't moved, since all current migrations depend on other models that aren't
109+
going to be moved.
110+
In the community site we run an initial migration,
111+
for the corporate site we run a fake migration.
112+
113+
For managers and querysets that depend on subscriptions,
114+
we can use our pattern to make overridable classes (inheriting from ``SettingsOverrideObject``).
115+
116+
Templates, urls, views, forms, notifications, signals, tasks can be moved later
117+
(we just need to make use from the models from the `readthedocs.organizations` module).
118+
119+
If we decide to integrate organizations in the community site,
120+
we can enable the app.
121+
122+
After the app is moved,
123+
we can move more code that depends on organizations to the community site.
124+
80125
Namespace
81126
---------
82127

@@ -90,3 +135,11 @@ And most of the users don't have a custom domain.
90135
We could keep the current behavior for the community site and use `organization.slug` + `project.slug` for the corporate site,
91136
since in the corporate site we don't care so much about a unique namespace between all users, but a unique namespace per organization.
92137
We can refactor the way we get the namespace to be more easy to manage in both sites.
138+
139+
Future Changes
140+
--------------
141+
142+
Changes that aren't needed immediately after the migration,
143+
but that should be done:
144+
145+
Edit the current querysets, modify/add UI elements, and add new endpoints to the API (v3 only).

0 commit comments

Comments
 (0)