Repository: rucio/rucio

Issue:
Development docker updates + documentation fixes
Motivation
----------

Some usability enhancements for the development environment.


Discussion:

Resolving patch:
diff --git a/lib/rucio/db/sqla/migrate_repo/versions/8523998e2e76_increase_size_of_extended_attributes_.py b/lib/rucio/db/sqla/migrate_repo/versions/8523998e2e76_increase_size_of_extended_attributes_.py
--- a/lib/rucio/db/sqla/migrate_repo/versions/8523998e2e76_increase_size_of_extended_attributes_.py
+++ b/lib/rucio/db/sqla/migrate_repo/versions/8523998e2e76_increase_size_of_extended_attributes_.py
@@ -35,7 +35,8 @@ def upgrade():
     '''
 
     if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']:
-        alter_column('rse_protocols', 'extended_attributes', existing_type=sa.String(1024), type_=sa.String(4000))
+        schema = context.get_context().version_table_schema if context.get_context().version_table_schema else ''
+        alter_column('rse_protocols', 'extended_attributes', existing_type=sa.String(1024), type_=sa.String(4000), schema=schema)
 
 
 def downgrade():
@@ -44,4 +45,5 @@ def downgrade():
     '''
 
     if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']:
-        alter_column('rse_protocols', 'extended_attributes', existing_type=sa.String(4000), type_=sa.String(1024))
+        schema = context.get_context().version_table_schema if context.get_context().version_table_schema else ''
+        alter_column('rse_protocols', 'extended_attributes', existing_type=sa.String(4000), type_=sa.String(1024), schema=schema)
diff --git a/lib/rucio/db/sqla/util.py b/lib/rucio/db/sqla/util.py
--- a/lib/rucio/db/sqla/util.py
+++ b/lib/rucio/db/sqla/util.py
@@ -1,15 +1,23 @@
-# Copyright European Organization for Nuclear Research (CERN)
+# Copyright 2015-2019 CERN for the benefit of the ATLAS collaboration.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
-# You may not use this file except in compliance with the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 # Authors:
-# - Vincent Garonne, <vincent.garonne@cern.ch>, 2013-2016
-# - Mario Lassnig, <mario.lassnig@cern.ch>, 2013-2014, 2017-2018
-# - Martin Barisits, <martin.barisits@cern.ch>, 2014
-# - Hannes Hansen, <hannes.jakob.hansen@cern.ch>, 2019
-# - Andrew Lister, <andrew.lister@stfc.ac.uk>, 2019
+# - Vincent Garonne <vgaronne@gmail.com>, 2015-2016
+# - Martin Barisits <martin.barisits@cern.ch>, 2017
+# - Mario Lassnig <mario@lassnig.net>, 2018-2019
+# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2019
+# - Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
 #
 # PY3K COMPATIBLE
 
@@ -22,7 +30,7 @@
 
 from sqlalchemy import func
 from sqlalchemy.engine import reflection
-from sqlalchemy.schema import MetaData, Table, DropTable, ForeignKeyConstraint, DropConstraint
+from sqlalchemy.schema import CreateSchema, MetaData, Table, DropTable, ForeignKeyConstraint, DropConstraint
 from sqlalchemy.sql.expression import select, text
 
 from rucio.common.config import config_get
@@ -35,6 +43,15 @@
 def build_database(echo=True, tests=False):
     """ Applies the schema to the database. Run this command once to build the database. """
     engine = session.get_engine(echo=echo)
+
+    schema = config_get('database', 'schema', raise_exception=False)
+    if schema:
+        print('Schema set in config, trying to create schema:', schema)
+        try:
+            engine.execute(CreateSchema(schema))
+        except Exception as e:
+            print('Cannot create schema, please validate manually if schema creation is needed, continuing:', e)
+
     models.register_models(engine)
 
     # Put the database under version control


Test patch: