Giter Club home page Giter Club logo

dj-migration-test's Introduction

Hi there ๐Ÿ‘‹

My name is Philipp. I have a B. Sc. in Mathematics and am a big software engineering entusiast that loves to explore numerical and statistical methods to solve problems.

  • ๐Ÿง™โ€โ™‚๏ธ Over the past years I've been cooking several things
  • ๐ŸŒฑ Iโ€™m currently learning techniques of Game Development ๐Ÿ‘พ, Machine Learning ๐Ÿค–, Computer Vision ๐ŸŒŽ, Reinforced Deep-Q-Learning ๐Ÿค and solving differential equations ๐Ÿ“ˆ.
  • โœ๏ธ You can contact me via Mail or other social channels listed in my profile

Check out my contributions on other platforms, like HuggingFace ๐Ÿค—

https://philipp-zettl-my-heatmap.static.hf.space


  • ๐Ÿ‘จโ€๐Ÿซ Early 2022 I wrote my Thesis with the topic: "Machine Learning Methods for Localiazation and Classification of Insects in Images" and plan to build a more advanced guideline for object detection / image classification tasks.
  • ๐Ÿง‘โ€๐Ÿซ In summer 2023 I taught an introductory class to Machine Learning at Berliner Hochschule fรผr Technik (BHT)

dj-migration-test's People

Contributors

dependabot[bot] avatar philipp-zettl avatar philsupertramp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

dj-migration-test's Issues

add support for factories

I noticed using factory-boy breaks test cases having factories using models with newly introduced fields.

version

current release: dj-migration-test-0.1a0

minimal setup to begin with

model.py

import factory
from django.db import models


class ModelA(models.Model):
    field1 = models.BooleanField(default=True)


class ModelB(models.Model):
    relation_field = models.ForeignKey(to='ModelA', on_delete=models.CASCADE)


class ModelAFactory(factory.DjangoModelFactory):
    class Meta:
        model = ModelA


class ModelBFactory(factory.DjangoModelFactory):
    relation_field = factory.SubFactory(ModelAFactory)
    field2 = models.BooleanField(default=False)

    class Meta:
        model = ModelB
Generated migrations

0001_initial.py

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ModelA',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field1', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='ModelB',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('relation_field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='factories.ModelA')),
            ],
        ),
    ]

0002_modelb_field2.py

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('factories', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='modelb',
            name='field2',
            field=models.BooleanField(default=False),
        ),
    ]

test.py

from dj_migration_test import MigrationTestCase

from factories.factories import ModelBFactory


class FirstMigrationTestCase(MigrationTestCase):
    migrate_to = ('factories', '0002_modelb_field2')

    @staticmethod
    def setUpDataBeforeMigration(self, apps):
        model_b = ModelBFactory()
        self.model_b_id = model_b.id

    def test_thread_migration(self):
        model_b_class = self.apps.get_model('factories', 'ModelB')
        model_b = model_b_class.objects.get(id=self.model_b_id)

        self.assertFalse(model_b.field2)

running the test suite results in

[...]
django.db.utils.OperationalError: table factories_modelb has no column named field2

and fails already in setUpDataBeforeMigration.

update readme

the readme still contains the badge from circle-ci

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.