Commit Graph

19 Commits

Author SHA1 Message Date
Leo Franchi 8fe82085c4 [schema][manual] Automatically subscribe users to default streams only after tutorial
(imported from commit 6511851c0aee2628bef597bf1310d6f96b0fd1d4)
2013-04-04 17:11:39 -04:00
Tim Abbott a1aae4a39f [South] [schema] Add an index on Userprofile.email.
We accidentally lost this when we did the User/UserProfile merge (this
commit also deletes the old code to add the auth_user index in
do-destroy-rebuild-database).

This below is mostly just notes for future reference, but when
deploying this change to staging, we should consider running the
following instead of using the migration directly:

CREATE UNIQUE INDEX CONCURRENTLY zephyr_userprofile_email_uniq ON zephyr_userprofile(email);
ALTER TABLE zephyr_userprofile ADD CONSTRAINT zephyr_userprofile_email_uniq UNIQUE USING INDEX zephyr_userprofile_email_uniq;
CREATE INDEX CONCURRENTLY zephyr_userprofile_email ON zephyr_userprofile(email);

But I think it might be the case that it's fine to just run it
directly, since the ALTER TABLE part seems to hang if there's an open
transaction working on a UserProfile object anyway.

(imported from commit 1bf34ce242de51e97c91c8bab86b6b273e17fb43)
2013-04-04 15:45:42 -04:00
Tim Abbott 33562adc4f Update subscription color migration to run on sqlite.
(imported from commit 8ca8d36b390d4afb85fca725b0ba2fb539438a0d)
2013-04-04 15:25:43 -04:00
Tim Abbott b06284717c [South] Migration to add color to Subscription model.
(imported from commit 0dc8c5924b6398ea73e90c5322dd4fd1beddccf1)
2013-04-04 14:17:01 -04:00
Tim Abbott 6448428a9e [schema] Remove User model.
(imported from commit bc182e6e947c3b3f09382e890e3751c2f4021a58)
2013-04-02 13:24:33 -04:00
Tim Abbott 659ccc2174 [schema] Add South migration for extending UserProfile to subsume User.
(imported from commit 1f93bd1fc93bb5f2b7f144d1631428e1c5e96292)
2013-04-01 14:34:25 -04:00
Tim Abbott b0dedfa310 [south] Add rendered_content columns.
See the next commit for the models changes.

(imported from commit 90e753661f8abfcfcdb78a5bbc15ebaf7f2eff9b)
2013-03-19 08:09:26 -04:00
Leo Franchi 60eeffc82d Fix 0012 migration to work with sqlite
(imported from commit 05ed67e199bdaa1485912748b304cdb890b6115b)
2013-03-13 11:52:06 -04:00
Leo Franchi 794c897bbc Lower thresholds for migration speed
(imported from commit da749dcdeb9396fa71c09e0b6f7275a67b1568f0)
2013-03-13 11:52:04 -04:00
Leo Franchi 2c4c6ba43e [schema][manual] Add South migration for flags on UserMessage
(imported from commit bdf6cf2d5427709e52ef051e3c4a19c5fbb4851c)
2013-03-13 10:20:56 -04:00
Jeff Arnold ebb9be1ead [south] Add enter-sends field to UserProfile model.
(imported from commit e8a153bdcbe4abc00a7361c85c1347ec2bf39efa)
2013-02-27 17:25:15 -05:00
Leo Franchi 31f87481d0 [manual][schema] Add an API for user presence (idle) information
Adds a new db table for storing presences, and an API for setting
an individual user's idleness as well as fetching all idle status
for all users in a realm

(imported from commit 5aad3510d4c90c49470c130d6dfa80f0d36b0057)
2013-02-11 18:05:57 -05:00
Jessica McKellar 8d06143115 [manual][schema] Add a restricted_to_domain bit on realms.
Default True; if False, arbitrary e-mail addresses can use your realm.

(imported from commit 6eec7516a535429cbaa74f6348651feef73cacd6)
2013-02-08 13:16:35 -05:00
Zev Benjamin 88937655fd [manual] Add a ts_vector cache column on zephyr_message along with the appropriate trigger and index
This needs to be done in three South migrations to not block users
from sending messages for a long time.  Adding the column requires a
write lock on the zephyr_message table and populating the new column
takes a long time.  Thus, we can't do them both in the same
transaction (which South forces on migrations).  Additionally,
creating the index takes a lot of computation and needs to lock the
table when not done CONCURRENTLY, which can't be done inside of a
transaction.

To do this manual change, you need to run:
    python manage.py migrate zephyr 0007
    ssh postgres.humbughq.com 'echo "CREATE INDEX CONCURRENTLY zephyr_message_search_tsvector ON zephyr_message USING gin(search_tsvector);" | psql'
    python manage.py migrate zephyr 0008

on staging. No action is required on prod since the database is
shared.

Note that this migration must be done completely before we switch to
using the tsvector cache column.

(imported from commit b6a27013a60c1fd196eabb095d2d11d20bba5aac)
2013-02-06 12:09:49 -05:00
Luke Faraone f0afa56cd3 [manual] South migration for Subscriptions model change.
Autogenerated schema migration:
 + Added field in_home_view on zephyr.Subscription

To do this manual change, you need to run:
    python manage.py migrate zephyr 0005

on staging. No action is required on prod since there is a shared database.

(imported from commit d554f17b25631482ec2d5605a42ac0b9d6df421e)
2013-02-05 15:34:35 -05:00
Zev Benjamin c6d196a22f [manual] Add South migration for creating a Postgres full text index of messages
This schema migration is only for use in automated migrations.  To
deploy on the production database (the migration only needs to be
done once for both of staging and prod because they share a
database), you should instead execute the following SQL manually:

$ ssh postgres.humbughq.com
$ psql
humbug=> CREATE INDEX CONCURRENTLY zephyr_message_full_text_idx ON zephyr_message USING gin(to_tsvector('english', subject || ' ' || content));

Note the addition of the "CONCURRENTLY" keyword.  The problem is that
creating the index takes non-trivial time and requires a write lock
on the table while the index is being created.  This would mean that
users would be unable to send messages while we were generating the
index, which isn't acceptable.  We can't create the index
concurrently in the South migration because concurrent index
creations can't happen inside of a transaction and South forces a
transaction on migration functions.

Also note that this index must be created before Postgres full text
search is deployed to the app because full text search without an index
is actually much slower than plain search using the LIKE operator.

(imported from commit 8b9445c27d0e427278de997b22342bffe6d855b7)
2013-01-31 15:57:45 -05:00
Leo Franchi 7d05450411 [schema][manual] Add schema invite_only flag for streams
(imported from commit 6234b67b3c72912bf40e39007bbc884d20774806)
2013-01-24 17:34:21 -05:00
Luke Faraone 7a43b4e30b [south] Migration for PreregistrationUser
Added field invited_at on zephyr.PreregistrationUser, with a one-time
default of Jan 1, 1970 for existing objects.

Added M2M table for streams on zephyr.PreregistrationUser
Deleted unique constraint for ['email'] on zephyr.PreregistrationUser

(imported from commit 85247acb488201f8fc51dfaae354423c27eddcb0)
2013-01-14 10:25:26 -05:00
Luke Faraone 3e7d036fca Include autogenerated initial migrations for South.
(imported from commit d1eda0d61ebe8a9d471670133589a1cf8058a802)
2013-01-08 18:14:39 -05:00