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

[WIP] Database changes for v005 #6302

Closed
wants to merge 1 commit into from
Closed

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Jan 7, 2016

This PR contains a partial migration. As such, it will put your database into a half-state. Only checkout this PR if your local branch is running on a database you don't care about (or have a copy of).

If you are on this branch, and switch back to master, your database will be too far ahead, and will cause the following error:

ERROR: Your database is not compatible with this version of Ghost 
 You will need to create a new database 

When this happens, you have 2 options:

  • delete the database
  • run FORCE_MIGRATION=true npm start to try to force the db back into a safe state (if you're on a production blog, read this)

Also, if changes are made to this PR and you've already run an earlier version of the 005 migration, you won't get the latest changes. In this case FORCE_MIGRATION=true npm start will cause the migrations to be re-run which should get your database into the right state.

refs #6301, #6165, #6255

  • Adds a new mobiledoc field to posts for the new editor spike
  • Adds a new is_private field to posts, so we can look at making only specific posts private
  • Changes tags.hidden to tags.hashtag. Atm that makes a new field - the migration tools need updating

@ErisDS
Copy link
Member Author

ErisDS commented Feb 7, 2016

This has been rebased against the reorganisation branch, but is still a WIP (see #6301 (comment)).

Whilst revisiting this, I figured it would make sense to make the new mobiledoc field longer inline with #4134.

It's currently set to "long", which in MySQL has a max length of 4,294,967,295/4GB (see http://stackoverflow.com/questions/13932750/tinytext-text-mediumtext-and-longtext-maximum-storage-sizes). However the maximum field length in postgres is 1GB (see https://wiki.postgresql.org/wiki/FAQ#What_is_the_maximum_size_for_a_row.2C_a_table.2C_and_a_database.3F) and the default max length for a field in SQLite3 is also 1GB (see https://www.sqlite.org/limits.html#max_length).

Therefore, the maxlength property (which is used for validations) has been set to 1000000000, which I believe will ensure we're catering for the minimum value across the 3 databases.

Wondering if it's worth doing this now, or whether it should match the html field to start with and get increased with the others. My thinking is, the format contains more syntax, so it probably will need more space than the HTML version.

refs TryGhost#6301, TryGhost#6165, TryGhost#6255

- Adds a new mobiledoc field to posts for the new editor spike, with a long text field
- Removes the tags.hidden field.
- Adds a new 'visibility' field to the 3 main models: Post, Tag, User for general purpose use with any feature which modifies where and when an object can be viewed
@ErisDS
Copy link
Member Author

ErisDS commented Mar 22, 2016

Closing in favour of #6628

I'll rewrite each of the migrations in the new style and pull them across one-by-one.

@ErisDS ErisDS closed this Mar 22, 2016
@ErisDS ErisDS deleted the data-005 branch May 22, 2016 12:34
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

Successfully merging this pull request may close these issues.

1 participant