4782 Commits

Author SHA1 Message Date
Christopher Allan Webber
d0e6665951 AUTHORS: Adding new 0.9.0 contributors.
* AUTHORS: Adding new contributors
2016-03-29 10:11:11 -07:00
Christopher Allan Webber
e47ed5c81c migrations: Only don't import "migrate" if it's not available
* mediagoblin/db/migrations.py: Import migrate if available; if not
  print a warning.
2016-03-29 09:44:34 -07:00
Christopher Allan Webber
dcccf654f5 doc: Update developer migration docs for Alembic as primary migration system
* docs/source/devel/migrations.rst: Update to reflect sqlalchemy-migrate
  as being deprecated and Alembic as being the new way of doing
  migrations.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
20adec8f26 Update make_example_database.sh to use #!/bin/sh instead of #!/usr/bin/env
* devtools/make_example_database.sh: Update shebang.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
cca25b6fcf doc: Update plugins documentation in light of alembic branching usage
* docs/source/siteadmin/plugins.rst:
  Added a reminder to run "./bin/gmg dbupdate" after installing a plugin.
  Added a new "Deactivating plugins" section.
  Renamed "Removing plugins" to "Removing plugin packages".
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
e3cfc9a84f dbupdate: Correctly handle plugin foundations
* mediagoblin/gmg_commands/dbupdate.py (run_foundations):
  When adding a plugin's foundations, correctly append both
  the name and the foundations in a tuple to the list.
  This prevents errors.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
5409a6cf23 doc: Note that plugin authors must NEVER modify tables they don't control
* docs/source/pluginwriter/database.rst: New paragraph.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
ee843c4783 Update database docs for plugin authors for new alembic branching world
Things have gotten both easier and more complex in the branching world
view.  Plugins branch off of main with their own migrations.
Generating these has become a bit easier, but the steps for doing this
are a bit wordy to explain.

* docs/source/pluginwriter/database.rst: Update both the
  "Creating new Tables" and "Changing the Database Schema Later"
  sections accordingly.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
8b7343c611 Add comment questioning why run_dbupdate is needed in get_app test utility
* mediagoblin/tests/tools.py (get_app): Add comment
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
544b7b47a1 Fix tests post-alembic-migration-changes.
* mediagoblin/init/__init__.py (setup_database): Update to run alembic
  migrations, skip the old legacy migrations.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
c527242841 Only run archivalook migration if the tables aren't there.
Standard for anything existing before the Alembic move-over, but I
forgot this one.

* mediagoblin/plugins/archivalook/migrations/b10b5f822789_archivalook_plugin_initial_migration.py
  (upgrade): Add has_table check, skip if such a table already exists.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
ddbe3fef8c Archivalook plugin initial migration.
* mediagoblin/plugins/archivalook/migrations/b10b5f822789_archivalook_plugin_initial_migration.py:
  New file.
2016-03-26 11:39:08 -07:00
Christopher Allan Webber
efeb1fef99 OpenID plugin initial migration.
* mediagoblin/plugins/openid/migrations/071abb33d1da_openid_plugin_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
c82716c853 Persona plugin initial migration.
* mediagoblin/plugins/persona/migrations/c7d4840a5592_persona_plugin_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
90779509bb Blog media type initial migration.
* mediagoblin/media_types/blog/migrations/562bc42a8fff_blog_media_type_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
c9ab4b8adb PDF media type initial migration.
* mediagoblin/media_types/pdf/migrations/faa209f143b5_pdf_media_type_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
f1577a7257 STL media type initial migration.
* mediagoblin/media_types/stl/migrations/16134ed134ad_stl_media_type_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
99a51bbde6 Ascii media type initial migration.
* mediagoblin/db/migrations/versions/72bd70f7eefd_ascii_media_type_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
7d37209755 Video media type initial migration.
* mediagoblin/media_types/video/migrations/38feb829c545_video_media_type_initial_migration.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
050bf6f438 Audio media type initial migration.
* mediagoblin/media_types/audio/migrations/e9212d3a12d3_adding_audio_media_type_initial_.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
2d8b42aab3 Image media type initial migration.
* mediagoblin/media_types/image/migrations/a98c1a320e88_image_media_type_initial.py:
  New file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
385b5b44f5 Removing erronously installed print statement.
* mediagoblin/gmg_commands/alembic_commands.py (FudgedCommandLine.main):
  Removed call to print.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
406058b340 Allow for passing in --with-plugins to the alembic gmg subcommand.
This allows plugin writers to easily take advantage off alembic's migration
autogeneration support.

* mediagoblin/gmg_commands/alembic_commands.py: Adjusted imports.
  (FudgedCommandLine.main, parser_setup): Add support for importing
  plugins when --with-plugins is passed in.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
f25b476202 Only run sqlalchemy-migrate migrations if we have to; separate foundations
The goal is to get things to the point where Alembic can run on its own
for new databases and initialize the whole database on its own.  There
are risks to not doing so, see #5413 for details.

There's a lot more here that could removed or cleaned up once
sqlalchemy-migrate is *completely* removed in the future.

* mediagoblin/db/migration_tools.py (MigrationManager.foundations):
  Removed attribute.
  (MigrationManager.populate_table_foundations): Removed method.
  (MigrationManager.init_or_migrate): Removed call to deprecated method.
  (populate_table_foundations): New function, refactored from former
  MigrationManager method of same name.

* mediagoblin/gmg_commands/dbupdate.py: Import populate_table_foundations.
  (DatabaseData.foundations): Remove attribute.
  (DatabaseData.make_migration_manager): Adjust instantiation of
  MigrationManager.
  (gather_database_data): Move out the work of building up foundations data.
  (run_foundations): New method, incorporating logic for gathering and
  running foundations which was previously spread across other
  functions and methods.
  (run_alembic_migrations): Remove deprecated comment.
  (run_dbupdate): Only run sqlalchemy migrations if we have to.
  Also run run_foundations if we are setting up this database for the
  first time.
  (sqam_migrations_to_run): New method.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
8a26b07298 Switch initial_revision alembic migration to make tables if they aren't there
This is a necessary step towards deprecating sqlalchemy-migrate.

* mediagoblin/db/migrations/versions/52bf0ccbedc1_initial_revision.py
  (upgrade): Update for adding tables.  Mostly generated via Alembic's
  autogenerate tools.
  (downgrade): Added a comment.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
ae44f97da4 Set target_metadata in alembic's env.py to Base.metadata
This allows us to make use of automatically generated migrations, at
least for core.

* mediagoblin/db/migrations/env.py (target_metadata): Switch to gmg's
  Base.metadata.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
c122a9d24e Update out script.py mako template to support branch_labels
This is important (probably) for long-running plugin branches.

* mediagoblin/db/migrations/script.py.mako: Updated to upstream
  Alembic version of this file.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
05879c1c76 dbupdate updates to use plugin migrations if available
This makes use of the recently added "build_alembic_config" tool and
removes AlembicMigrationManager.

* mediagoblin/db/migration_tools.py (AlembicMigrationManager): Removed.
* mediagoblin/gmg_commands/dbupdate.py (run_alembic_migrations):
  Adjusted to use recently added build_alembic_config tool.
2016-03-26 11:39:07 -07:00
Christopher Allan Webber
731df78225 Ignore .eggs/ directory 2016-03-26 11:39:07 -07:00
Christopher Allan Webber
6e9041aa4b Add build_alembic_config, use it to add plugin migrations to alembic config 2016-03-26 11:39:07 -07:00
Christopher Allan Webber
3f08f780f6 guix-env.scm: Comment on python-numpy pulling in texlive
textlive-texmf is currently a dependency of texlive in Guix, and is
very large.  Users may want to know and disable this dependency, if
they can bear limiting the media types they are developing with.

* guix-env.scm: New comment on returned package.
2016-03-24 14:23:49 -07:00
Christopher Allan Webber
0ce775ac2a Remove requirement that audio/video dependencies must be installed for tests
Some tests were added for running audio and video submission tests in
test_submission.py.  Unfortunately these were not skipped if these
dependencies were not installed.  This patch attempts to fix that while
leaving the tests intact.
2016-03-18 12:32:22 -07:00
Boris Bobrov
339cfb3894 Merge branch 'master' of git.sv.gnu.org:/srv/git/mediagoblin 2016-03-12 00:34:15 +03:00
Christopher Allan Webber
f0346c7aad Add python-gst to guix-env.scm 2016-03-09 12:05:31 -08:00
Boris Bobrov
86dc32bc20 Check all tags for existence before using them
Fix bug 5401
2016-03-09 12:28:14 +03:00
Boris Bobrov
17aaab6907 Fix module name for gmg alembic command
gmg_commands.alembic attempted to import from `alembic`. On python2.7
it resulted in import from itself.

Rename alembic.py to alembic_commands.py and fix references to
gmg_commands.alembic.
2016-03-08 18:23:45 +03:00
Boris Bobrov
fec916dfbe Check tags for existence before using them
Closes bug 5401
2016-03-08 17:37:04 +03:00
Andrew Browning
ee7db0a3d1 Fix #5440 - Typo in blog views 2016-03-06 19:47:17 -05:00
Christopher Allan Webber
4efa61c16a Commentary on where this hack on detecting no subcommand to Alembic comes from 2016-03-05 16:28:41 -08:00
Andrew Browning
512ed083b7 Fix comment ID links on blog media page
Change the comment ID behaviour and source of
user_pages/blog_media.html to match user_pages/media.html as of #5376.
2016-03-05 11:58:23 -05:00
Andrew Browning
b1d4973ca4 Fix comment ID links on media comment report page
Change the comment ID behaviour and source of user_pages/report.html
to match user_pages/media.html as of #5376.
2016-03-05 11:39:57 -05:00
Christopher Allan Webber
399272eea5 Add "gmg raw_alembic" command.
This allows you to dispatch to the "alembic" command line tool properly,
but properly respecting MediaGoblin's own configuration.
2016-03-03 09:31:00 -08:00
Christopher Allan Webber
a48736fc09 typo fix: Set sqlalchemy.url, not qlalchemy.url 2016-03-02 16:08:12 -08:00
Christopher Allan Webber
af6b89eafe Remove old hack to support pre-0.7.5 Alembic versions
Thanks to Jessica Tallon for pointing out this TODO and its associated
hack could be removed.
2016-03-02 11:20:47 -08:00
Christopher Allan Webber
0c9c5cab62 Remove version caps on sqlalchemy and alembic.
Code seems to pass fine after the cap is removed.  Whatever dependency
issues we were running into before don't seem to be an issue now.
2016-03-02 11:20:47 -08:00
Andrew Browning
690597ef83 Fix #5432 - Comment report link doens't work
This builds on work done for #5376 and associates the correct comment
ID with comment report links.
2016-03-02 12:45:07 -05:00
Andrew Browning
289826dc46 Fix #5435 - Bad comment links cause server error
This patch addresses an issue where a server error is caused by
entering a non-existent comment ID in a media URL.
2016-03-02 12:31:55 -05:00
Jessica Tallon
161bc6b2c1 Fix #5376 - Ensure links have correct ID
This ensures that links to comments have the correct ID (the
ID of the Comment object) as well as fixing deletion on reports
and fixing a few other little things. I hope this fixes the #5376
issue, though cannot reproduce so unable to confirm.
2016-03-01 12:04:08 +00:00
Andrew Browning
1db8690fe9 Fix #5433 - Typo in decorators 2016-03-01 01:00:14 -05:00
Andrew Browning
d508435985 Fix #5431 - Typo in models
Fix a typo in models.py.
2016-03-01 00:28:42 -05:00