remove all refrences to alembic
This commit is contained in:
@@ -17,7 +17,7 @@ Bien que **ctp_blogr** soit une application minimale et simple, elle possède to
|
||||
|
||||
- Python 3.9.6
|
||||
- Pyramid 2.0.2
|
||||
- SQLite 3.35.5
|
||||
- SQLite 3.43.2
|
||||
- pyramid-jinja2 2.7 : view templating
|
||||
- wtforms 3.2.1 : form library
|
||||
- webhelpers2 2.0 : various web building related helpers
|
||||
|
||||
+1026
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
"""Pyramid bootstrap environment. """
|
||||
from alembic import context
|
||||
from pyramid.paster import get_appsettings, setup_logging
|
||||
from sqlalchemy import engine_from_config
|
||||
|
||||
from ctp_blogr.models.meta import Base
|
||||
|
||||
config = context.config
|
||||
|
||||
setup_logging(config.config_file_name)
|
||||
|
||||
settings = get_appsettings(config.config_file_name)
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
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.
|
||||
|
||||
"""
|
||||
context.configure(url=settings['sqlalchemy.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(settings, prefix='sqlalchemy.')
|
||||
|
||||
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()
|
||||
@@ -1,22 +0,0 @@
|
||||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision | comma,n}
|
||||
Create Date: ${create_date}
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
branch_labels = ${repr(branch_labels)}
|
||||
depends_on = ${repr(depends_on)}
|
||||
|
||||
def upgrade():
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
def downgrade():
|
||||
${downgrades if downgrades else "pass"}
|
||||
@@ -1,42 +0,0 @@
|
||||
"""added foreign key to allocation
|
||||
|
||||
Revision ID: b8f8216d72c7
|
||||
Revises:
|
||||
Create Date: 2023-01-29 12:20:48.097107
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b8f8216d72c7'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('allocation',
|
||||
sa.Column('no_cat', sa.Integer(), nullable=False),
|
||||
sa.Column('classe', sa.Unicode(length=45), nullable=True),
|
||||
sa.Column('pc_cible', sa.Integer(), nullable=True),
|
||||
sa.Column('pc_atteint', sa.Float(), nullable=True),
|
||||
sa.Column('pc_ecart', sa.Float(), nullable=True),
|
||||
sa.Column('valeur', sa.Float(), nullable=True),
|
||||
sa.Column('type', sa.Unicode(length=45), nullable=True),
|
||||
sa.Column('ordre', sa.Integer(), nullable=True),
|
||||
sa.Column('bg_color', sa.Unicode(length=45), nullable=True),
|
||||
sa.ForeignKeyConstraint(['classe'], ['actifs.classe'], name=op.f('fk_allocation_classe_actifs')),
|
||||
sa.PrimaryKeyConstraint('no_cat', name=op.f('pk_allocation'))
|
||||
)
|
||||
op.create_index('classe_index', 'allocation', ['classe'], unique=False)
|
||||
op.create_index('ordre_index', 'allocation', ['ordre'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('ordre_index', table_name='allocation')
|
||||
op.drop_index('classe_index', table_name='allocation')
|
||||
op.drop_table('allocation')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1 +0,0 @@
|
||||
Placeholder for alembic versions
|
||||
@@ -1,49 +0,0 @@
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from pyramid.paster import bootstrap, setup_logging
|
||||
from sqlalchemy.exc import OperationalError
|
||||
|
||||
from .. import models
|
||||
|
||||
|
||||
def setup_models(dbsession):
|
||||
"""
|
||||
Add or update models / fixtures in the database.
|
||||
|
||||
"""
|
||||
|
||||
model = models.user.User(name=u'admin', password=u'pcao.7513')
|
||||
dbsession.add(model)
|
||||
|
||||
|
||||
def parse_args(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'config_uri',
|
||||
help='Configuration file, e.g., development.ini',
|
||||
)
|
||||
return parser.parse_args(argv[1:])
|
||||
|
||||
|
||||
def main(argv=sys.argv):
|
||||
args = parse_args(argv)
|
||||
setup_logging(args.config_uri)
|
||||
env = bootstrap(args.config_uri)
|
||||
|
||||
try:
|
||||
with env['request'].tm:
|
||||
dbsession = env['request'].dbsession
|
||||
setup_models(dbsession)
|
||||
except OperationalError:
|
||||
print('''
|
||||
Pyramid is having a problem using your SQL database. The problem
|
||||
might be caused by one of the following things:
|
||||
|
||||
1. You may need to initialize your database tables with `alembic`.
|
||||
Check your README.txt for description and try to run it.
|
||||
|
||||
2. Your database server may not be running. Check that the
|
||||
database server referred to by the "sqlalchemy.url" setting in
|
||||
your "development.ini" file is running.
|
||||
''')
|
||||
@@ -47,7 +47,6 @@
|
||||
<span class="glyphicon glyphicon-user"></span> Modifier le mot de passe</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li><a href="{{ request.route_url('portfolio') }}"><span class="glyphicon glyphicon-briefcase"></span> Portfolio</a></li>
|
||||
<li><a href="{{ request.route_url('tags') }}"><span class="glyphicon glyphicon-tag"></span> Tags</a></li>
|
||||
<li><a href="{{ request.route_url('logout') }}"><span class="glyphicon glyphicon-off"></span> Se déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -29,12 +29,6 @@ setup = ctp_blogr.pshell.setup
|
||||
# wsgi server configuration
|
||||
###
|
||||
|
||||
[alembic]
|
||||
# path to migration scripts
|
||||
script_location = ctp_blogr/alembic
|
||||
file_template = %%(year)d%%(month).2d%%(day).2d_%%(rev)s
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
[server:main]
|
||||
use = egg:waitress#main
|
||||
listen = localhost:9280
|
||||
|
||||
@@ -23,12 +23,6 @@ setup = ctp_blogr.pshell.setup
|
||||
# wsgi server configuration
|
||||
###
|
||||
|
||||
[alembic]
|
||||
# path to migration scripts
|
||||
script_location = ctp_blogr/alembic
|
||||
file_template = %%(year)d%%(month).2d%%(day).2d_%%(rev)s
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
[server:main]
|
||||
use = egg:waitress#main
|
||||
listen = *:9280
|
||||
|
||||
Reference in New Issue
Block a user