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

Replace page column on posts table with type column #10922

Closed
6 tasks done
allouis opened this issue Jul 18, 2019 · 6 comments
Closed
6 tasks done

Replace page column on posts table with type column #10922

allouis opened this issue Jul 18, 2019 · 6 comments
Assignees
Labels
affects:api Affects the Ghost API server / core Issues relating to the server or core of Ghost

Comments

@allouis
Copy link
Contributor

allouis commented Jul 18, 2019

Currently we have a page column which is a non-nullable boolean column which defaults to false

We want to replace this column with a type column,
non-nullable string which defaults to 'post' and has validations to ensure it is obly ever set to 'page' or 'post'

  • Remove page column from schema
  • Add type column to schema
  • Add migration for copying data from page -> type column
  • Add migrations for dropping the page column
  • Update the model layer to reflect changes
  • Update the serialiser layer to reflect changes
@allouis
Copy link
Contributor Author

allouis commented Jul 18, 2019

@gargol Would be cool if you could give the checkboxes here a once over to confirm it makes sense

@naz naz added affects:api Affects the Ghost API data server / core Issues relating to the server or core of Ghost labels Jul 18, 2019
@naz
Copy link
Member

naz commented Jul 18, 2019

@allouis the plan looks 👌

Just to expand the topic on serialization level. In v2 I see a pretty straight forward solution modifying the input serializer to fit the new model. Guess the bigger deal will be fitting the new field with v01 controllers 🤔

Also as for model layer changes, it would need a little more details on the approach. Is it going to be something similar to Author model we have where it's a separate model that extends User or the change is purely "cosmetical" in Post model where the flag page will be substituted by appropriate type (this approach seems the most appropriate in terms of time/impact)?

@allouis
Copy link
Contributor Author

allouis commented Jul 19, 2019

👍

I think both input & output serialiser would need to be changed right? because the v2 api outputs the page parameter when reading from it right?

As for model layer changes - I was thinking that it would just be replacing the page flag - but tbh a new model is a more complete approach - grows the size of this issue a lot though - what do you think?

@naz
Copy link
Member

naz commented Jul 19, 2019

I think both input & output serialiser would need to be changed right?

Yup 👍

but tbh a new model is a more complete approach

Yes, this is true and I don't think it's worth an effort just to be "clean" in respect of model separation. Changing existing post model should be enough.

@allouis
Copy link
Contributor Author

allouis commented Jul 19, 2019

Awesome - I agree 💃

@allouis allouis self-assigned this Jul 19, 2019
allouis added a commit to allouis/Ghost that referenced this issue Aug 12, 2019
allouis added a commit to allouis/Ghost that referenced this issue Aug 12, 2019
refs TryGhost#10922

The frontend UrlGenerator parses the filters itself rather than passing
to the api, so we need to replicate the conversion from page -> type
allouis added a commit that referenced this issue Aug 12, 2019
refs #10922

The frontend UrlGenerator parses the filters itself rather than passing
to the api, so we need to replicate the conversion from page -> type
allouis added a commit to allouis/Ghost that referenced this issue Aug 12, 2019
rishabhgrg pushed a commit that referenced this issue Aug 12, 2019
refs #10922

* Updated canary api to handle type column correctly

* Updated unit tests

* Updated regression tests
kevinansfield added a commit to kevinansfield/Ghost that referenced this issue Sep 16, 2019
refs TryGhost#10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
kevinansfield added a commit that referenced this issue Sep 16, 2019
refs #10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs TryGhost/Ghost#10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs TryGhost/Ghost#10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs TryGhost/Ghost#10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs TryGhost/Ghost#10922

- adds migrations to...
  1. add `post.type` column
  2. populate `post.type` column based on `post.page` value
  3. drop `post.page` column
- updates all code paths to work with `post.type` in place of `post.page`
- adds `nql-map-key-values` transformer for mapping `page`->`type` in `filter` params when using the v2 API
- modifies importer to handle `post.page`->`post.type` transformation when importing older export files
naz added a commit to naz/Ghost that referenced this issue May 16, 2022
refs TryGhost/Toolbox#332
refs TryGhost#10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
naz added a commit to naz/Ghost that referenced this issue May 16, 2022
closes TryGhost/Toolbox#332
refs TryGhost#10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
naz added a commit that referenced this issue May 16, 2022
refs TryGhost/Toolbox#332
refs #10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
naz added a commit that referenced this issue May 16, 2022
closes TryGhost/Toolbox#332
refs #10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

No branches or pull requests

2 participants