Giter Club home page Giter Club logo

Comments (10)

bernardopires avatar bernardopires commented on September 22, 2024

you have to run ./manage.py migrate_schemas not ./manage.py migrate

2013/6/23 maxwelld90 [email protected]

Hello,

Thank you for writing this app - it is fantastic - exactly what I am in
need of.

I am having a bit of difficulty getting integration with South working. I
have followed your simple tutorial at
https://django-tenant-schemas.readthedocs.org/en/latest/use.html - after
setting everything up as stated in
https://django-tenant-schemas.readthedocs.org/en/latest/install.html.

However, I am still confused with how I can use South and this app. I see
the commands in the tutorial but cannot figure out the order in which I run
them.

For example, I wish to add an additional field, 'additional_field', to the
Client model. I add in the field, then I run ./manage.py migrate. But I
receive a DatabaseError:

DatabaseError: column customers_client.additional_field does not exist
LINE 1: ...ent"."paid_until", "customers_client"."on_trial", "customers...

Am I missing something? Can someone provide a simple example as to how
this can be rectified?

Many thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/49
.

Bernardo Pires Carneiro

from django-tenant-schemas.

maxwelld90 avatar maxwelld90 commented on September 22, 2024

Thanks for getting back to me.

When I run ./manage.py migrate_schemas, I get the same DatabaseError : - (

=== Running migrate for schema public
DatabaseError: column customers_client.additional_field does not exist
LINE 1: ...ent"."paid_until", "customers_client"."on_trial", "customers...

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 22, 2024

the error you are getting is unusual. it should not try to find
additional_field, considering this is the field you are trying to add. are
you sure you have the correct migrations?

2013/6/23 maxwelld90 [email protected]

Thanks for getting back to me.

When I run ./manage.py migrate_schemas, I get the same DatabaseError : - (

=== Running migrate for schema public

DatabaseError: column customers_client.additional_field does not exist
LINE 1: ...ent"."paid_until", "customers_client"."on_trial", "customers...

Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-19875026
.

Bernardo Pires Carneiro

from django-tenant-schemas.

caioariede avatar caioariede commented on September 22, 2024

I got the same error. Very strange because I didn't get this error before.

from django-tenant-schemas.

caioariede avatar caioariede commented on September 22, 2024

It seems a bit odd, but I managed to workaround this situation by changing get_tenant_model().objects calls to get_tenant_model().objects.only('schema_name') so it does not looks for additional fields that exists in the code but not in the database.

I mean it does look odd because I didn't have this problem before. Nonetheless it's very understandable.

from django-tenant-schemas.

caioariede avatar caioariede commented on September 22, 2024

@bcarneiro could you try to reproduce this behavior?

Just add a field to the model referred by get_tenant_model() then create a migration and try to run it.

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 22, 2024

Sorry Caio, couldn't reproduce this issue. I have a model called LawFirm and I added a new field.

./manage.py schemamigration firms --auto

  • Added field balance_available2 on firms.LawFirm
    Created 0002_auto__add_field_lawfirm_balance_available2.py. You can now apply this migration with: ./manage.py migrate firms

./manage.py migrate_schemas
=== Running migrate for schema public
Running migrations for firms:

  • Migrating forwards to 0002_auto__add_field_lawfirm_balance_available2.

    firms:0002_auto__add_field_lawfirm_balance_available2

  • Loading initial data for firms.
    Installed 0 object(s) from 0 fixture(s)

Can you try to get a sequence of steps to reproduce your error? Thanks!

from django-tenant-schemas.

caioariede avatar caioariede commented on September 22, 2024

Is LawFirm defined as your TENANT_MODEL?

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 22, 2024

Yes, TENANT_MODEL = "firms.LawFirm"

2013/8/12 Caio Ariede [email protected]

Is LawFirm defined as your TENANT_MODEL?


Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-22516343
.

Bernardo Pires Carneiro

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 22, 2024

I'm closing this as it seems noone can reproduce this issue. Feel free to open it if you guys have any new information about it!

from django-tenant-schemas.

Related Issues (20)

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.