misc/migration/bootstrapmigration_repository.py
changeset 1808 aa09e20dd8c0
parent 1501 c80ca83a382f
child 1952 8e19c813750d
equal deleted inserted replaced
1693:49075f57cf2c 1808:aa09e20dd8c0
     1 """allways executed before all others in server migration
     1 """allways executed before all others in server migration
     2 
     2 
     3 it should only include low level schema changes
     3 it should only include low level schema changes
     4 
     4 
     5 :organization: Logilab
     5 :organization: Logilab
     6 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     6 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     7 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     8 """
     8 """
       
     9 
       
    10 if applcubicwebversion < (3, 2, 0) and cubicwebversion >= (3, 2, 0):
       
    11    add_cube('card', update_database=False)
     9 
    12 
    10 if applcubicwebversion < (2, 47, 0) and cubicwebversion >= (2, 47, 0):
    13 if applcubicwebversion < (2, 47, 0) and cubicwebversion >= (2, 47, 0):
    11     from cubicweb.server import schemaserial
    14     from cubicweb.server import schemaserial
    12     schemaserial.HAS_FULLTEXT_CONTAINER = False
    15     schemaserial.HAS_FULLTEXT_CONTAINER = False
    13     cnx.set_shared_data('do-not-insert-is_instance_of', True)
    16     session.set_shared_data('do-not-insert-is_instance_of', True)
    14     add_attribute('ERType', 'fulltext_container')
    17     add_attribute('CWRType', 'fulltext_container')
    15     schemaserial.HAS_FULLTEXT_CONTAINER = True
    18     schemaserial.HAS_FULLTEXT_CONTAINER = True
    16 
    19 
    17 
    20 
    18  
    21 
    19 if applcubicwebversion < (2, 50, 0) and cubicwebversion >= (2, 50, 0):
    22 if applcubicwebversion < (2, 50, 0) and cubicwebversion >= (2, 50, 0):
    20     cnx.set_shared_data('do-not-insert-is_instance_of', True)
    23     session.set_shared_data('do-not-insert-is_instance_of', True)
    21     add_relation_type('is_instance_of')
    24     add_relation_type('is_instance_of')
    22     # fill the relation using an efficient sql query instead of using rql
    25     # fill the relation using an efficient sql query instead of using rql
    23     sql('INSERT INTO is_instance_of_relation '
    26     sql('INSERT INTO is_instance_of_relation '
    24 	'  SELECT * from is_relation')
    27 	'  SELECT * from is_relation')
    25     checkpoint()
    28     checkpoint()
    26     cnx.set_shared_data('do-not-insert-is_instance_of', False)
    29     session.set_shared_data('do-not-insert-is_instance_of', False)
    27 
    30 
    28 if applcubicwebversion < (2, 42, 0) and cubicwebversion >= (2, 42, 0):
    31 if applcubicwebversion < (2, 42, 0) and cubicwebversion >= (2, 42, 0):
    29     sql('ALTER TABLE entities ADD COLUMN mtime TIMESTAMP')
    32     sql('ALTER TABLE entities ADD COLUMN mtime TIMESTAMP')
    30     sql('UPDATE entities SET mtime=CURRENT_TIMESTAMP')
    33     sql('UPDATE entities SET mtime=CURRENT_TIMESTAMP')
    31     sql('CREATE INDEX entities_mtime_idx ON entities(mtime)')
    34     sql('CREATE INDEX entities_mtime_idx ON entities(mtime)')
    38 )''')
    41 )''')
    39     sql('CREATE INDEX deleted_entities_type_idx ON deleted_entities(type)')
    42     sql('CREATE INDEX deleted_entities_type_idx ON deleted_entities(type)')
    40     sql('CREATE INDEX deleted_entities_dtime_idx ON deleted_entities(dtime)')
    43     sql('CREATE INDEX deleted_entities_dtime_idx ON deleted_entities(dtime)')
    41     sql('CREATE INDEX deleted_entities_extid_idx ON deleted_entities(extid)')
    44     sql('CREATE INDEX deleted_entities_extid_idx ON deleted_entities(extid)')
    42     checkpoint()
    45     checkpoint()
    43    
    46