Commits

Anonymous committed f59961a

Evolution code and docs, and a small build bug

Comments (0)

Files changed (11)

build-tools/SPECS/transifex.spec.in

 BuildArch:  noarch
 
 BuildRequires:  Django python-sphinx gettext-devel
-Requires:   Django django-authopenid django-contact-form
+Requires:   Django django-authopenid=0.9.6 django-contact-form
 Requires:   django-notification django-pagination django-tagging
-Requires:   python-markdown python-polib python-pygments
+Requires:   python-markdown python-polib python-pygments django-evolution
 Requires:   mercurial python-urlgrabber
 Requires:   intltool >= 0.37.1
 

docs/releases/0.6.txt

 Upgrading to 0.6
 ----------------
 
-- The schema for the tables that store the remote repository information
-  has changed. If there is no information in the tables then a
-  ``python manage.py reset codebases tarball vcs`` will update your database.
+- The schema has undergone many changes, and 0.6 includes code to perform
+  a schema evolution using ``django-evolution``. To use it, first add
+  ``django_evolution`` to ``INSTALLED_APPS`` in the 0.5.x Transifex
+  configuration, then run ``python manage.py syncdb``. Proceed to upgrade
+  the project to 0.6, then run ``python manage.py syncdb``, ``python
+  manage.py evolve ---execute``, and then ``python manage.py syncdb`` again.
+  The first invocation of ``syncdb`` will result in an exception, but this
+  may be safely ignored.
 - The settings files have been broken down for easier maintenance in
   ``settings/``. The ``settings.py`` file needs to be overwritten with the new
   version and settings migrated to the respective ``.conf`` files. 
 
-(This section urgently needs more text.)
-
-
 Contributors
 ------------
 

transifex/actionlog/evolutions/06_actionlog_v2.py

+#----- Evolution for actionlog
+from django_evolution.mutations import *
+from django.conf import settings
+from django.db import models
+
+MUTATIONS = [
+    AddField('LogEntry', 'object_name', models.CharField, initial='', max_length=200),
+    AddField('LogEntry', 'message', models.TextField, null=True),
+    AddField('LogEntry', 'action_type', models.ForeignKey, initial='', related_model='notification.NoticeType'),
+    DeleteField('LogEntry', 'action_flag'),
+    DeleteField('LogEntry', 'object_repr'),
+    DeleteField('LogEntry', 'change_message'),
+    ChangeField('LogEntry', 'user', initial=None, null=True)
+]
+#----------------------

transifex/actionlog/evolutions/__init__.py

+SEQUENCE = ['06_actionlog_v2']

transifex/codebases/evolutions/__init__.py

+SEQUENCE = ['init_codebases']

transifex/codebases/evolutions/init_codebases.sql

+DROP TABLE tarball_tarball;
+DROP TABLE vcs_vcsunit;
+DROP TABLE codebases_unit;
+ALTER TABLE vcs_unit RENAME TO codebases_unit;
+ALTER SEQUENCE vcs_unit_id_seq RENAME TO codebases_unit_id_seq;
+ALTER TABLE codebases_unit DROP CONSTRAINT vcs_unit_name_key;
+ALTER TABLE codebases_unit ADD CONSTRAINT codebases_unit_name_key UNIQUE(name);
+ALTER TABLE projects_component DROP CONSTRAINT projects_component_unit_id_fkey;
+ALTER TABLE projects_component ADD FOREIGN KEY(unit_id) REFERENCES codebases_unit (id) DEFERRABLE INITIALLY DEFERRED;
+SELECT id AS unit_ptr_id, branch, web_frontend INTO vcs_vcsunit FROM codebases_unit;
+ALTER TABLE vcs_vcsunit ADD PRIMARY KEY(unit_ptr_id);
+ALTER TABLE vcs_vcsunit ADD FOREIGN KEY(unit_ptr_id) REFERENCES codebases_unit (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE vcs_vcsunit ALTER COLUMN branch SET NOT NULL;
+ALTER TABLE codebases_unit DROP COLUMN branch;
+ALTER TABLE codebases_unit DROP COLUMN web_frontend;

transifex/languages/evolutions/06_plurals.py

+#----- Evolution for languages
+from django_evolution.mutations import *
+from django.db import models
+
+MUTATIONS = [
+    AddField('Language', 'pluralequation', models.CharField, initial='', max_length=255),
+    AddField('Language', 'nplurals', models.SmallIntegerField, initial=0),
+    AddField('Language', 'specialchars', models.CharField, initial='', max_length=255)
+]
+#----------------------

transifex/languages/evolutions/__init__.py

+SEQUENCE = ['06_plurals']

transifex/settings/50-project.conf

     'notification',
     # OpenId support (needs middleware class above too)
     'django_authopenid',
+    'django_evolution',
     'tagging',
     'pagination',
     'contact_form',

transifex/translations/evolutions/06_add_lang_code.py

+#----- Evolution for translations
+from django_evolution.mutations import *
+from django.db import models
+
+MUTATIONS = [
+    AddField('POFile', 'language_code', models.CharField, max_length=20, null=True)
+]
+#----------------------

transifex/translations/evolutions/__init__.py

+SEQUENCE = ['06_add_lang_code']