Commit cf1a479a authored by Gero Müller's avatar Gero Müller
Browse files

fix alembic upgrade for sqlite

parent 76228fd3
......@@ -36,7 +36,9 @@ setup(
package_data={"vispa": files},
scripts=["bin/vispa", "bin/vispad"],
install_requires=["sqlalchemy >= 0.9.0", "mako", "cherrypy",
"paramiko", "rpyc", "alembic >= 0.7.3", "passlib", "ws4py"],
"paramiko", "rpyc",
"alembic >= 0.7.3", # for Operations.batch_alter_table
"passlib", "ws4py"],
extras_require={"doc": ["sphinx", "sphinx-bootstrap-theme"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
......
......@@ -5,6 +5,7 @@ Revises: 2c7093ed3ed6
Create Date: 2014-09-12 11:59:28.725938
"""
from alembic import op
from sqlalchemy.types import Unicode, UnicodeText
from sqlalchemy.sql.elements import quoted_name
......@@ -13,171 +14,150 @@ from sqlalchemy.sql.elements import quoted_name
revision = '17d572bdfd2d'
down_revision = '2c7093ed3ed6'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column(
"user",
"name",
type_=Unicode(255),
existing_type=Unicode(30))
op.alter_column(
"user",
"password",
type_=UnicodeText,
existing_type=Unicode(128))
op.alter_column(
"user",
"email",
type_=Unicode(255),
existing_type=Unicode(100))
op.alter_column(
"user",
"hash",
type_=UnicodeText,
existing_type=Unicode(100))
op.alter_column(
"workspace",
"name",
type_=Unicode(255),
existing_type=Unicode(100))
op.alter_column(
"workspace",
"host",
type_=UnicodeText,
existing_type=Unicode(100))
op.alter_column(
"workspace",
"login",
type_=UnicodeText,
existing_type=Unicode(100))
op.alter_column(
"vispa_preference",
"section",
type_=Unicode(255),
existing_type=Unicode(64))
op.alter_column(
"vispa_preference",
"value",
type_=UnicodeText,
existing_type=Unicode(300))
op.alter_column(
"extension_preference",
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
op.alter_column(
"extension_preference",
"value",
type_=UnicodeText,
existing_type=Unicode(300))
op.alter_column(
"vispa_shortcuts",
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
op.alter_column(
"vispa_shortcuts",
"value",
type_=UnicodeText,
existing_type=Unicode(300))
op.alter_column(
"extension_shortcuts",
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
op.alter_column(
"extension_shortcuts",
"value",
type_=UnicodeText,
existing_type=Unicode(300))
with op.batch_alter_table("user") as batch_op:
batch_op.alter_column(
"name",
type_=Unicode(255),
existing_type=Unicode(30))
batch_op.alter_column(
"password",
type_=UnicodeText,
existing_type=Unicode(128))
batch_op.alter_column(
"email",
type_=Unicode(255),
existing_type=Unicode(100))
batch_op.alter_column(
"hash",
type_=UnicodeText,
existing_type=Unicode(100))
with op.batch_alter_table("workspace") as batch_op:
batch_op.alter_column(
"name",
type_=Unicode(255),
existing_type=Unicode(100))
batch_op.alter_column(
"host",
type_=UnicodeText,
existing_type=Unicode(100))
batch_op.alter_column(
"login",
type_=UnicodeText,
existing_type=Unicode(100))
with op.batch_alter_table("vispa_preference") as batch_op:
batch_op.alter_column(
"section",
type_=Unicode(255),
existing_type=Unicode(64))
batch_op.alter_column(
"value",
type_=UnicodeText,
existing_type=Unicode(300))
with op.batch_alter_table("extension_preference") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
batch_op.alter_column(
"value",
type_=UnicodeText,
existing_type=Unicode(300))
with op.batch_alter_table("vispa_shortcuts") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
batch_op.alter_column(
"value",
type_=UnicodeText,
existing_type=Unicode(300))
with op.batch_alter_table("extension_shortcuts") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(255),
existing_type=Unicode(64))
batch_op.alter_column(
"value",
type_=UnicodeText,
existing_type=Unicode(300))
def downgrade():
op.alter_column(
"user",
"name",
type_=Unicode(30),
existing_type=Unicode(255))
op.alter_column(
"user",
"password",
type_=Unicode(128),
existing_type=UnicodeText)
op.alter_column(
"user",
"email",
type_=Unicode(100),
existing_type=Unicode(255))
op.alter_column(
"user",
"hash",
type_=Unicode(100),
existing_type=UnicodeText)
op.alter_column(
"workspace",
"name",
type_=Unicode(100),
existing_type=Unicode(255))
op.alter_column(
"workspace",
"host",
type_=Unicode(100),
existing_type=UnicodeText)
op.alter_column(
"workspace",
"login",
type_=Unicode(100),
existing_type=UnicodeText)
op.alter_column(
"vispa_preference",
"section",
type_=Unicode(64),
existing_type=Unicode(255))
op.alter_column(
"vispa_preference",
"value",
type_=Unicode(300),
existing_type=UnicodeText)
op.alter_column(
"extension_preference",
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
op.alter_column(
"extension_preference",
"value",
type_=Unicode(300),
existing_type=UnicodeText)
op.alter_column(
"vispa_shortcuts",
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
op.alter_column(
"vispa_shortcuts",
"value",
type_=Unicode(300),
existing_type=UnicodeText)
op.alter_column(
"extension_shortcuts",
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
op.alter_column(
"extension_shortcuts",
"value",
type_=Unicode(300),
existing_type=UnicodeText)
with op.batch_alter_table("user") as batch_op:
batch_op.alter_column(
"name",
type_=Unicode(30),
existing_type=Unicode(255))
batch_op.alter_column(
"password",
type_=Unicode(128),
existing_type=UnicodeText)
batch_op.alter_column(
"email",
type_=Unicode(100),
existing_type=Unicode(255))
batch_op.alter_column(
"hash",
type_=Unicode(100),
existing_type=UnicodeText)
with op.batch_alter_table("workspace") as batch_op:
batch_op.alter_column(
"name",
type_=Unicode(100),
existing_type=Unicode(255))
batch_op.alter_column(
"host",
type_=Unicode(100),
existing_type=UnicodeText)
batch_op.alter_column(
"login",
type_=Unicode(100),
existing_type=UnicodeText)
with op.batch_alter_table("vispa_preference") as batch_op:
batch_op.alter_column(
"section",
type_=Unicode(64),
existing_type=Unicode(255))
batch_op.alter_column(
"value",
type_=Unicode(300),
existing_type=UnicodeText)
with op.batch_alter_table("extension_preference") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
batch_op.alter_column(
"value",
type_=Unicode(300),
existing_type=UnicodeText)
with op.batch_alter_table("vispa_shortcuts") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
batch_op.alter_column(
"value",
type_=Unicode(300),
existing_type=UnicodeText)
with op.batch_alter_table("extension_shortcuts") as batch_op:
batch_op.alter_column(
quoted_name("key", True),
type_=Unicode(64),
existing_type=Unicode(255))
batch_op.alter_column(
"value",
type_=Unicode(300),
existing_type=UnicodeText)
......@@ -5,22 +5,29 @@ Revises: 3e4b5288af61
Create Date: 2014-03-30 14:28:14.618331
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '190d66accdad'
down_revision = '3e4b5288af61'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('workspace',
sa.Column('auto_connect', sa.Boolean(), nullable=True))
op.add_column('workspace',
sa.Column('login_credencials', sa.Boolean(), nullable=True))
with op.batch_alter_table("workspace") as batch_op:
batch_op.add_column(
sa.Column(
'login_credencials',
sa.Boolean(),
nullable=True))
batch_op.add_column(
sa.Column(
'auto_connect',
sa.Boolean(),
nullable=True))
def downgrade():
op.drop_column('workspace', 'login_credencials')
op.drop_column('workspace', 'auto_connect')
with op.batch_alter_table("workspace") as batch_op:
batch_op.drop_column('login_credencials')
batch_op.drop_column('auto_connect')
......@@ -5,19 +5,19 @@ Revises: 190d66accdad
Create Date: 2014-04-02 16:26:51.748774
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2a4a3fd96ecf'
down_revision = '190d66accdad'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column('workspace', u'port')
with op.batch_alter_table("workspace") as batch_op:
batch_op.drop_column('port')
def downgrade():
op.add_column('workspace',
sa.Column(u'port', sa.Integer(), nullable=False))
with op.batch_alter_table("workspace") as batch_op:
batch_op.add_column(sa.Column('port', sa.Integer(), nullable=False))
......@@ -5,35 +5,40 @@ Revises: 350433110367
Create Date: 2014-05-13 17:44:51.149159
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2c7093ed3ed6'
down_revision = '350433110367'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('group',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=32), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('grouplist',
sa.Column('group_id', sa.Integer(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
### end Alembic commands ###
op.create_table(
'group',
sa.Column(
'id',
sa.Integer(),
nullable=False),
sa.Column(
'name',
sa.Unicode(
length=32),
nullable=False),
sa.Column(
'created',
sa.DateTime(),
nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name'))
op.create_table(
'grouplist', sa.Column(
'group_id', sa.Integer(), nullable=True), sa.Column(
'user_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(
['group_id'], ['group.id'], ), sa.ForeignKeyConstraint(
['user_id'], ['user.id'], ))
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('grouplist')
op.drop_table('group')
### end Alembic commands ###
......@@ -5,22 +5,23 @@ Revises: 5887b0150ba1
Create Date: 2014-04-11 10:05:49.919687
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '350433110367'
down_revision = '5887b0150ba1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('last_password_reset', sa.DateTime(), nullable=True))
### end Alembic commands ###
with op.batch_alter_table("user") as batch_op:
batch_op.add_column(
sa.Column(
'last_password_reset',
sa.DateTime(),
nullable=True))
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'last_password_reset')
### end Alembic commands ###
with op.batch_alter_table("user") as batch_op:
batch_op.drop_column('user', 'last_password_reset')
......@@ -5,117 +5,167 @@ Revises: None
Create Date: 2014-03-27 16:21:23.472862
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3e4b5288af61'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=30), nullable=False),
sa.Column('password', sa.Unicode(length=128), nullable=False),
sa.Column('email', sa.Unicode(length=100), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('last_request', sa.DateTime(), nullable=False),
sa.Column('status', sa.Integer(), nullable=False),
sa.Column('hash', sa.Unicode(length=100), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('name')
)
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=30), nullable=False),
sa.Column(
'password',
sa.Unicode(
length=128),
nullable=False),
sa.Column('email', sa.Unicode(length=100), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('last_request', sa.DateTime(), nullable=False),
sa.Column('status', sa.Integer(), nullable=False),
sa.Column('hash', sa.Unicode(length=100), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('name')
)
op.create_table('access_statistics',
sa.Column('user_ip', sa.Unicode(length=60), nullable=False),
sa.Column('user_agent', sa.Unicode(length=200), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('pis', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('user_ip', 'user_agent', 'date')
)
sa.Column(
'user_ip',
sa.Unicode(
length=60),
nullable=False),
sa.Column(
'user_agent',
sa.Unicode(
length=200),
nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('pis', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('user_ip', 'user_agent', 'date')
)
op.create_table('page_statistics',
sa.Column('page', sa.Unicode(length=128), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('pis', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('page', 'date')
)
sa.Column('page', sa.Unicode(length=128), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('pis', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('page', 'date')
)
op.create_table('workspace',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=100), nullable=False),
sa.Column('host', sa.Text(),