| Conditions | 1 |
| Total Lines | 126 |
| Code Lines | 110 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | """init |
||
| 18 | def upgrade(): |
||
| 19 | ### commands auto generated by Alembic - please adjust! ### |
||
| 20 | op.create_table('labeltype', |
||
| 21 | sa.Column('name', sa.String(length=20), nullable=False), |
||
| 22 | sa.Column('description', sa.Text(), nullable=True), |
||
| 23 | sa.PrimaryKeyConstraint('name') |
||
| 24 | ) |
||
| 25 | op.create_table('language', |
||
| 26 | sa.Column('id', sa.String(length=64), nullable=False), |
||
| 27 | sa.Column('name', sa.String(length=255), nullable=True), |
||
| 28 | sa.PrimaryKeyConstraint('id') |
||
| 29 | ) |
||
| 30 | op.create_table('conceptscheme', |
||
| 31 | sa.Column('id', sa.Integer(), nullable=False), |
||
| 32 | sa.Column('uri', sa.String(length=512), nullable=True), |
||
| 33 | sa.PrimaryKeyConstraint('id') |
||
| 34 | ) |
||
| 35 | op.create_table('notetype', |
||
| 36 | sa.Column('name', sa.String(length=20), nullable=False), |
||
| 37 | sa.Column('description', sa.Text(), nullable=True), |
||
| 38 | sa.PrimaryKeyConstraint('name') |
||
| 39 | ) |
||
| 40 | op.create_table('label', |
||
| 41 | sa.Column('id', sa.Integer(), nullable=False), |
||
| 42 | sa.Column('label', sa.String(length=512), nullable=False), |
||
| 43 | sa.Column('labeltype_id', sa.String(length=20), nullable=False), |
||
| 44 | sa.Column('language_id', sa.String(length=64), nullable=True), |
||
| 45 | sa.ForeignKeyConstraint(['labeltype_id'], ['labeltype.name'], ), |
||
| 46 | sa.ForeignKeyConstraint(['language_id'], ['language.id'], ), |
||
| 47 | sa.PrimaryKeyConstraint('id') |
||
| 48 | ) |
||
| 49 | op.create_index('ix_label_labeltype_id', 'label', ['labeltype_id'], unique=False) |
||
| 50 | op.create_index('ix_label_language_id', 'label', ['language_id'], unique=False) |
||
| 51 | op.create_table('note', |
||
| 52 | sa.Column('id', sa.Integer(), nullable=False), |
||
| 53 | sa.Column('note', sa.Text(), nullable=False), |
||
| 54 | sa.Column('notetype_id', sa.String(length=20), nullable=False), |
||
| 55 | sa.Column('language_id', sa.String(length=64), nullable=True), |
||
| 56 | sa.ForeignKeyConstraint(['language_id'], ['language.id'], ), |
||
| 57 | sa.ForeignKeyConstraint(['notetype_id'], ['notetype.name'], ), |
||
| 58 | sa.PrimaryKeyConstraint('id') |
||
| 59 | ) |
||
| 60 | op.create_index('ix_note_language_id', 'note', ['language_id'], unique=False) |
||
| 61 | op.create_index('ix_note_notetype_id', 'note', ['notetype_id'], unique=False) |
||
| 62 | op.create_table('concept', |
||
| 63 | sa.Column('id', sa.Integer(), nullable=False), |
||
| 64 | sa.Column('type', sa.String(length=30), nullable=True), |
||
| 65 | sa.Column('concept_id', sa.Integer(), nullable=False), |
||
| 66 | sa.Column('uri', sa.String(length=512), nullable=True), |
||
| 67 | sa.Column('conceptscheme_id', sa.Integer(), nullable=False), |
||
| 68 | sa.ForeignKeyConstraint(['conceptscheme_id'], ['conceptscheme.id'], ), |
||
| 69 | sa.PrimaryKeyConstraint('id') |
||
| 70 | ) |
||
| 71 | op.create_index('ix_concept_concept_id', 'concept', ['concept_id'], unique=False) |
||
| 72 | op.create_index('ix_concept_conceptscheme_id', 'concept', ['conceptscheme_id'], unique=False) |
||
| 73 | op.create_table('collection_concept', |
||
| 74 | sa.Column('collection_id', sa.Integer(), nullable=False), |
||
| 75 | sa.Column('concept_id', sa.Integer(), nullable=False), |
||
| 76 | sa.ForeignKeyConstraint(['collection_id'], ['concept.id'], ), |
||
| 77 | sa.ForeignKeyConstraint(['concept_id'], ['concept.id'], ), |
||
| 78 | sa.PrimaryKeyConstraint('collection_id', 'concept_id') |
||
| 79 | ) |
||
| 80 | op.create_table('conceptscheme_note', |
||
| 81 | sa.Column('conceptscheme_id', sa.Integer(), nullable=False), |
||
| 82 | sa.Column('note_id', sa.Integer(), nullable=False), |
||
| 83 | sa.ForeignKeyConstraint(['conceptscheme_id'], ['conceptscheme.id'], ), |
||
| 84 | sa.ForeignKeyConstraint(['note_id'], ['note.id'], ), |
||
| 85 | sa.PrimaryKeyConstraint('conceptscheme_id', 'note_id') |
||
| 86 | ) |
||
| 87 | op.create_table('conceptscheme_label', |
||
| 88 | sa.Column('conceptscheme_id', sa.Integer(), nullable=False), |
||
| 89 | sa.Column('label_id', sa.Integer(), nullable=False), |
||
| 90 | sa.ForeignKeyConstraint(['conceptscheme_id'], ['conceptscheme.id'], ), |
||
| 91 | sa.ForeignKeyConstraint(['label_id'], ['label.id'], ), |
||
| 92 | sa.PrimaryKeyConstraint('conceptscheme_id', 'label_id') |
||
| 93 | ) |
||
| 94 | op.create_table('visitation', |
||
| 95 | sa.Column('id', sa.Integer(), nullable=False), |
||
| 96 | sa.Column('lft', sa.Integer(), nullable=False), |
||
| 97 | sa.Column('rght', sa.Integer(), nullable=False), |
||
| 98 | sa.Column('depth', sa.Integer(), nullable=False), |
||
| 99 | sa.Column('conceptscheme_id', sa.Integer(), nullable=False), |
||
| 100 | sa.Column('concept_id', sa.Integer(), nullable=False), |
||
| 101 | sa.ForeignKeyConstraint(['concept_id'], ['concept.id'], ), |
||
| 102 | sa.ForeignKeyConstraint(['conceptscheme_id'], ['conceptscheme.id'], ), |
||
| 103 | sa.PrimaryKeyConstraint('id') |
||
| 104 | ) |
||
| 105 | op.create_index('ix_visitation_concept_id', 'visitation', ['concept_id'], unique=False) |
||
| 106 | op.create_index('ix_visitation_conceptscheme_id', 'visitation', ['conceptscheme_id'], unique=False) |
||
| 107 | op.create_index('ix_visitation_depth', 'visitation', ['depth'], unique=False) |
||
| 108 | op.create_index('ix_visitation_lft', 'visitation', ['lft'], unique=False) |
||
| 109 | op.create_index('ix_visitation_rght', 'visitation', ['rght'], unique=False) |
||
| 110 | op.create_table('concept_note', |
||
| 111 | sa.Column('concept_id', sa.Integer(), nullable=False), |
||
| 112 | sa.Column('note_id', sa.Integer(), nullable=False), |
||
| 113 | sa.ForeignKeyConstraint(['concept_id'], ['concept.id'], ), |
||
| 114 | sa.ForeignKeyConstraint(['note_id'], ['note.id'], ), |
||
| 115 | sa.PrimaryKeyConstraint('concept_id', 'note_id') |
||
| 116 | ) |
||
| 117 | op.create_table('concept_related_concept', |
||
| 118 | sa.Column('concept_id_from', sa.Integer(), nullable=False), |
||
| 119 | sa.Column('concept_id_to', sa.Integer(), nullable=False), |
||
| 120 | sa.ForeignKeyConstraint(['concept_id_from'], ['concept.id'], ), |
||
| 121 | sa.ForeignKeyConstraint(['concept_id_to'], ['concept.id'], ), |
||
| 122 | sa.PrimaryKeyConstraint('concept_id_from', 'concept_id_to') |
||
| 123 | ) |
||
| 124 | op.create_table('concept_hierarchy_concept', |
||
| 125 | sa.Column('concept_id_broader', sa.Integer(), nullable=False), |
||
| 126 | sa.Column('concept_id_narrower', sa.Integer(), nullable=False), |
||
| 127 | sa.ForeignKeyConstraint(['concept_id_broader'], ['concept.id'], ), |
||
| 128 | sa.ForeignKeyConstraint(['concept_id_narrower'], ['concept.id'], ), |
||
| 129 | sa.PrimaryKeyConstraint('concept_id_broader', 'concept_id_narrower') |
||
| 130 | ) |
||
| 131 | op.create_table('concept_hierarchy_collection', |
||
| 132 | sa.Column('concept_id_broader', sa.Integer(), nullable=False), |
||
| 133 | sa.Column('collection_id_narrower', sa.Integer(), nullable=False), |
||
| 134 | sa.ForeignKeyConstraint(['collection_id_narrower'], ['concept.id'], ), |
||
| 135 | sa.ForeignKeyConstraint(['concept_id_broader'], ['concept.id'], ), |
||
| 136 | sa.PrimaryKeyConstraint('concept_id_broader', 'collection_id_narrower') |
||
| 137 | ) |
||
| 138 | op.create_table('concept_label', |
||
| 139 | sa.Column('concept_id', sa.Integer(), nullable=False), |
||
| 140 | sa.Column('label_id', sa.Integer(), nullable=False), |
||
| 141 | sa.ForeignKeyConstraint(['concept_id'], ['concept.id'], ), |
||
| 142 | sa.ForeignKeyConstraint(['label_id'], ['label.id'], ), |
||
| 143 | sa.PrimaryKeyConstraint('concept_id', 'label_id') |
||
| 144 | ) |
||
| 178 |