Commit 9468c24a authored by Francesca Sargent 's avatar Francesca Sargent
Browse files

Is Git working..?

parent 5d7ee148
No preview for this file type
Generic single-database configuration.
\ No newline at end of file
# A generic, single database configuration.
[alembic]
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from flask import current_app
config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
connection = engine.connect()
context.configure(
connection=connection,
target_metadata=target_metadata
)
try:
with context.begin_transaction():
context.run_migrations()
finally:
connection.close()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision}
Create Date: ${create_date}
"""
# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
def upgrade():
${upgrades if upgrades else "pass"}
def downgrade():
${downgrades if downgrades else "pass"}
"""empty message
Revision ID: 12c0061c13d5
Revises: 3b07456f405e
Create Date: 2015-01-06 16:04:10.885325
"""
# revision identifiers, used by Alembic.
revision = '12c0061c13d5'
down_revision = '3b07456f405e'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('cuisinemethods', sa.Column('cuisine_name', sa.Integer(), nullable=True))
op.add_column('cuisinemethods', sa.Column('method_name', sa.Integer(), nullable=True))
op.drop_column('cuisinemethods', u'method_id')
op.drop_column('cuisinemethods', u'cuisine_id')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('cuisinemethods', sa.Column(u'cuisine_id', mysql.INTEGER(display_width=11), nullable=True))
op.add_column('cuisinemethods', sa.Column(u'method_id', mysql.INTEGER(display_width=11), nullable=True))
op.drop_column('cuisinemethods', 'method_name')
op.drop_column('cuisinemethods', 'cuisine_name')
### end Alembic commands ###
"""empty message
Revision ID: 1a27bbcfd8a8
Revises: 5ad0a670b37f
Create Date: 2015-01-06 14:24:48.383375
"""
# revision identifiers, used by Alembic.
revision = '1a27bbcfd8a8'
down_revision = '5ad0a670b37f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 1c2e4c20034b
Revises: 2f697a5ed32e
Create Date: 2014-12-05 14:18:14.091614
"""
# revision identifiers, used by Alembic.
revision = '1c2e4c20034b'
down_revision = '2f697a5ed32e'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 22f5c454fd74
Revises: 41bce8550de2
Create Date: 2015-01-21 11:58:31.578517
"""
# revision identifiers, used by Alembic.
revision = '22f5c454fd74'
down_revision = '41bce8550de2'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 2367478a2858
Revises: 1a27bbcfd8a8
Create Date: 2015-01-06 14:25:11.564520
"""
# revision identifiers, used by Alembic.
revision = '2367478a2858'
down_revision = '1a27bbcfd8a8'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 249290722b32
Revises: 3c9d6cb344d5
Create Date: 2014-12-05 10:59:36.575823
"""
# revision identifiers, used by Alembic.
revision = '249290722b32'
down_revision = '3c9d6cb344d5'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 26b2ff459dd0
Revises: 4c915f4312cd
Create Date: 2014-12-31 10:33:35.900715
"""
# revision identifiers, used by Alembic.
revision = '26b2ff459dd0'
down_revision = '4c915f4312cd'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
"""empty message
Revision ID: 285e2d130803
Revises: None
Create Date: 2015-01-19 12:18:53.739416
"""
# revision identifiers, used by Alembic.
revision = '285e2d130803'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('roles',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('default', sa.Boolean(), nullable=True),
sa.Column('permissions', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('username', sa.String(length=64), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('confirmed', sa.Boolean(), nullable=True),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('location', sa.String(length=64), nullable=True),
sa.Column('about_me', sa.Text(), nullable=True),
sa.Column('member_since', sa.DateTime(), nullable=True),
sa.Column('last_seen', sa.DateTime(), nullable=True),
sa.Column('avatar_hash', sa.String(length=32), nullable=True),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
op.create_table('methods',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('method_text', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_methods_timestamp'), 'methods', ['timestamp'], unique=False)
op.create_table('follows',
sa.Column('follower_id', sa.Integer(), nullable=False),
sa.Column('followed_id', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['followed_id'], ['users.id'], ),
sa.ForeignKeyConstraint(['follower_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('follower_id', 'followed_id')
)
op.create_table('cuisines',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('default', sa.Boolean(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_cuisines_default'), 'cuisines', ['default'], unique=False)
op.create_index(op.f('ix_cuisines_timestamp'), 'cuisines', ['timestamp'], unique=False)
op.create_table('cuisinemethods',
sa.Column('cuisine_name', sa.String(length=64), nullable=True),
sa.Column('method_name', sa.String(length=64), nullable=True),
sa.ForeignKeyConstraint(['cuisine_name'], ['cuisines.name'], ),
sa.ForeignKeyConstraint(['method_name'], ['methods.name'], )
)
op.create_table('recipes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=65), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('body_html', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.Column('cuisine_name', sa.String(length=64), nullable=True),
sa.Column('method_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.ForeignKeyConstraint(['cuisine_name'], ['cuisines.name'], ),
sa.ForeignKeyConstraint(['method_id'], ['methods.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_recipes_name'), 'recipes', ['name'], unique=True)
op.create_index(op.f('ix_recipes_timestamp'), 'recipes', ['timestamp'], unique=False)
op.create_table('comments',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('body_html', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('disabled', sa.Boolean(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.Column('recipe_id', sa.Integer(), nullable=True),
sa.Column('cuisine_id', sa.Integer(), nullable=True),
sa.Column('method_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.ForeignKeyConstraint(['cuisine_id'], ['cuisines.id'], ),
sa.ForeignKeyConstraint(['method_id'], ['methods.id'], ),
sa.ForeignKeyConstraint(['recipe_id'], ['recipes.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_comments_timestamp'), 'comments', ['timestamp'], unique=False)
op.create_table('recipesteps',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('recipe_id', sa.Integer(), nullable=True),
sa.Column('recipe_step_id', sa.Integer(), nullable=True),
sa.Column('recipe_step_text', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['recipe_id'], ['recipes.id'], ),
sa.PrimaryKeyConstraint('id')
)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('recipesteps')
op.drop_index(op.f('ix_comments_timestamp'), table_name='comments')
op.drop_table('comments')
op.drop_index(op.f('ix_recipes_timestamp'), table_name='recipes')
op.drop_index(op.f('ix_recipes_name'), table_name='recipes')
op.drop_table('recipes')
op.drop_table('cuisinemethods')
op.drop_index(op.f('ix_cuisines_timestamp'), table_name='cuisines')
op.drop_index(op.f('ix_cuisines_default'), table_name='cuisines')
op.drop_table('cuisines')
op.drop_table('follows')
op.drop_index(op.f('ix_methods_timestamp'), table_name='methods')
op.drop_table('methods')
op.drop_index(op.f('ix_users_username'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
op.drop_index(op.f('ix_roles_default'), table_name='roles')
op.drop_table('roles')
### end Alembic commands ###
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment