Skip to content

Commit

Permalink
new maintainer of resources implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mazvv committed May 15, 2016
1 parent 2c97ee8 commit db9a051
Show file tree
Hide file tree
Showing 292 changed files with 14,819 additions and 39,660 deletions.
Empty file added .eggs/easy-install.pth
Empty file.
Binary file removed .eggs/pytz-2014.10-py2.7.egg
Binary file not shown.
5 changes: 4 additions & 1 deletion alembic/env.py
Expand Up @@ -64,11 +64,14 @@ def run_migrations_online():
)

try:
default_schemas = [
'public', 'company_en', 'test', 'demo_ru', 'company_ru'
]
schemas = [
row[0] for row in connection.execute(
'select schema_name from information_schema.schemata'
)
if row[0] in ['public', 'company', 'test', 'demo_ru'] or re.match('r^(c\d+)', row[0])
if row[0] in default_schemas or re.match('r^(c\d+)', row[0])
]

for schema in schemas:
Expand Down
26 changes: 26 additions & 0 deletions alembic/versions/1e661947fa33_alter_db.py
@@ -0,0 +1,26 @@
"""alter db
Revision ID: 1e661947fa33
Revises: 8ea58c1b7416
Create Date: 2016-05-14 20:08:11.282984
"""

# revision identifiers, used by Alembic.
revision = '1e661947fa33'
down_revision = '8ea58c1b7416'

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 ###
26 changes: 26 additions & 0 deletions alembic/versions/5984ec75fe6f_alter_db.py
@@ -0,0 +1,26 @@
"""alter db
Revision ID: 5984ec75fe6f
Revises: d6019e611353
Create Date: 2016-05-09 11:48:51.032917
"""

# revision identifiers, used by Alembic.
revision = '5984ec75fe6f'
down_revision = 'd6019e611353'

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 ###
36 changes: 36 additions & 0 deletions alembic/versions/8ea58c1b7416_alter_db.py
@@ -0,0 +1,36 @@
"""alter db
Revision ID: 8ea58c1b7416
Revises: 5984ec75fe6f
Create Date: 2016-05-14 12:10:03.820778
"""

# revision identifiers, used by Alembic.
revision = '8ea58c1b7416'
down_revision = '5984ec75fe6f'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('dismissal',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('resource_id', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('employee_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['employee_id'], ['employee.id'], name='fk_employee_id_appointment', onupdate='cascade', ondelete='restrict'),
sa.ForeignKeyConstraint(['resource_id'], ['resource.id'], name='fk_resource_id_dismissal', onupdate='cascade', ondelete='restrict'),
sa.PrimaryKeyConstraint('id')
)
op.drop_column(u'employee', 'dismissal_date')
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column(u'employee', sa.Column('dismissal_date', sa.DATE(), autoincrement=False, nullable=True))
op.drop_table('dismissal')
### end Alembic commands ###
28 changes: 28 additions & 0 deletions alembic/versions/bdbc18f749f6_alter_db.py
@@ -0,0 +1,28 @@
"""alter db
Revision ID: bdbc18f749f6
Revises: 1e661947fa33
Create Date: 2016-05-15 17:39:27.590882
"""

# revision identifiers, used by Alembic.
revision = 'bdbc18f749f6'
down_revision = '1e661947fa33'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(u'fk_employee_id_task', 'task', type_='foreignkey')
op.drop_column('task', 'employee_id')
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('task', sa.Column('employee_id', sa.INTEGER(), autoincrement=False, nullable=False))
op.create_foreign_key(u'fk_employee_id_task', 'task', 'employee', ['employee_id'], ['id'], onupdate=u'CASCADE', ondelete=u'RESTRICT')
### end Alembic commands ###
40 changes: 40 additions & 0 deletions alembic/versions/d6019e611353_alter_db.py
@@ -0,0 +1,40 @@
"""alter db
Revision ID: d6019e611353
Revises: None
Create Date: 2016-05-09 11:38:02.281703
"""

# revision identifiers, used by Alembic.
revision = 'd6019e611353'
down_revision = None

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(u'fk_contract_id_caluclation', 'calculation', type_='foreignkey')
op.create_foreign_key('fk_contract_id_caluclation', 'calculation', 'contract', ['contract_id'], ['id'], onupdate='cascade', ondelete='restrict')
op.drop_constraint(u'fk_photo_upload_id_employee', 'employee', type_='foreignkey')
op.create_foreign_key('fk_photo_upload_id_employee', 'employee', 'upload', ['photo_upload_id'], ['id'], onupdate='cascade', ondelete='restrict')
op.drop_constraint(u'fk_maintainer_id_resource', 'resource', type_='foreignkey')
op.drop_constraint(u'fk_structure_id_resource', 'resource', type_='foreignkey')
op.create_foreign_key('fk_maintainer_id_resource', 'resource', 'employee', ['maintainer_id'], ['id'], onupdate='cascade', ondelete='restrict', use_alter=True)
op.drop_column('resource', 'structure_id')
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('resource', sa.Column('structure_id', sa.INTEGER(), autoincrement=False, nullable=False))
op.drop_constraint('fk_maintainer_id_resource', 'resource', type_='foreignkey')
op.create_foreign_key(u'fk_structure_id_resource', 'resource', 'structure', ['structure_id'], ['id'], onupdate=u'CASCADE', ondelete=u'RESTRICT')
op.create_foreign_key(u'fk_maintainer_id_resource', 'resource', 'employee', ['maintainer_id'], ['id'])
op.drop_constraint('fk_photo_upload_id_employee', 'employee', type_='foreignkey')
op.create_foreign_key(u'fk_photo_upload_id_employee', 'employee', 'upload', ['photo_upload_id'], ['id'])
op.drop_constraint('fk_contract_id_caluclation', 'calculation', type_='foreignkey')
op.create_foreign_key(u'fk_contract_id_caluclation', 'calculation', 'contract', ['contract_id'], ['id'])
### end Alembic commands ###
16 changes: 12 additions & 4 deletions development.ini
Expand Up @@ -20,6 +20,8 @@ pyramid.includes =
wsgithumb

sqlalchemy.url = postgres://mazvv:@127.0.0.1/travelcrm
sqlalchemy.pool_size = 10
sqlalchemy.max_overflow = 15
sqlalchemy.echo = False

public_domain = localhost
Expand All @@ -43,10 +45,10 @@ storage.base_path = %(here)s/data/storage
storage.extensions = images+documents

#scheduler
scheduler.url = sqlite:///jobs.sqlite
scheduler.db = 0
scheduler.executors.type = threadpool
scheduler.executors.max_workers = 20
scheduler.executors.processpool.max_workers = 20
scheduler.executors.processpool.max_workers = 5
scheduler.job_defaults.max_instances = 3
scheduler.autostart = true

Expand Down Expand Up @@ -80,15 +82,21 @@ port = 6543
[loggers]
keys = root, travelcrm, sqlalchemy

[handler_filelog]
class = FileHandler
args = ('%(here)s/log.log','a')
level = INFO
formatter = generic

[handlers]
keys = console
keys = console, filelog

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console
handlers = console, filelog

[logger_travelcrm]
level = DEBUG
Expand Down
1 change: 1 addition & 0 deletions dump.rdb
@@ -0,0 +1 @@
REDIS0006�ܳC�Z��V

0 comments on commit db9a051

Please sign in to comment.