mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	Because SQLite doesn't support full ALTER capabilities, alembic scripts
require batch operations.  However, that capability wasn't available until
0.7.0 which some distributions haven't reached yet.  Therefore, the batch
operations introduced in commit 86d6e44cc (review 2319) have been reverted
and SQLite is unsupported again, for now anyway.
Tested the full upgrade and downgrade on MySQL/Mariadb and Postgresql.
ASTERISK-25890 #close
Reported-by: Harley Peters
Change-Id: I82eba5456736320256f6775f5b0b40133f4d1c80
		
	
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
| #
 | |
| # Asterisk -- An open source telephony toolkit.
 | |
| #
 | |
| # Copyright (C) 2015, Richard Mudgett
 | |
| #
 | |
| # Richard Mudgett <rmudgett@digium.com>
 | |
| #
 | |
| # See http://www.asterisk.org for more information about
 | |
| # the Asterisk project. Please do not directly contact
 | |
| # any of the maintainers of this project for assistance;
 | |
| # the project provides a web site, mailing lists and IRC
 | |
| # channels for your use.
 | |
| #
 | |
| # This program is free software, distributed under the terms of
 | |
| # the GNU General Public License Version 2. See the LICENSE file
 | |
| # at the top of the source tree.
 | |
| #
 | |
| 
 | |
| """add rpid_immediate
 | |
| 
 | |
| Revision ID: 23530d604b96
 | |
| Revises: 45e3f47c6c44
 | |
| Create Date: 2015-03-18 17:41:58.055412
 | |
| 
 | |
| """
 | |
| 
 | |
| # revision identifiers, used by Alembic.
 | |
| revision = '23530d604b96'
 | |
| down_revision = '45e3f47c6c44'
 | |
| 
 | |
| from alembic import op
 | |
| import sqlalchemy as sa
 | |
| from sqlalchemy.dialects.postgresql import ENUM
 | |
| 
 | |
| YESNO_NAME = 'yesno_values'
 | |
| YESNO_VALUES = ['yes', 'no']
 | |
| 
 | |
| def upgrade():
 | |
|     ############################# Enums ##############################
 | |
| 
 | |
|     # yesno_values have already been created, so use postgres enum object
 | |
|     # type to get around "already created" issue - works okay with mysql
 | |
|     yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
 | |
| 
 | |
|     op.add_column('ps_endpoints', sa.Column('rpid_immediate', yesno_values))
 | |
| 
 | |
| def downgrade():
 | |
|     op.drop_column('ps_endpoints', 'rpid_immediate')
 |