Giter Club home page Giter Club logo

Comments (6)

artpar avatar artpar commented on May 27, 2024

Hi @zplzpl

What do you mean by optimizing the names ?

Daptin manages the table names, column names, relationship table names (for many to many), index names, foreign key names internally so that they don't clash with each other.

The table name you mentioned is a join table (a user otp account can belong to multiple user groups). Join table names follow this convection:

<SubjectTableName>_<SubjectColumnName>_has_<ObjectTableName>_<ObjectColumnName>

from daptin.

zplzpl avatar zplzpl commented on May 27, 2024

Is the name generation rule configurable?

from daptin.

artpar avatar artpar commented on May 27, 2024

The name generation rule for join tables isn't configurable as of now.

How would you have configured it. What kind of configuration are you looking for. Only join table names are generated and join tables are not usually directly accessed. If you are facing some other issue because of names, do bring it up.

from daptin.

zplzpl avatar zplzpl commented on May 27, 2024

It's too long for me

from daptin.

artpar avatar artpar commented on May 27, 2024

Do you have a better approach for the names ? The join table names are long for my taste as well but this is the only way I see to avoid any conflicts.

Consider the case when there can be multiple many to many joins between two tables or even a self join.

Lets say you have table t1 and t2, each with 2 columns: col1 and col2. Now we make a many to many join table for these two tables on t1.col1 = t2.col2. What would you name the join table for this ?

from daptin.

artpar avatar artpar commented on May 27, 2024

@zplzpl The join table names are configurable. Like I mentioned the join table name structure, when defining a relation, you can set the 4 params:

- Subject: <Table> 
  SubjectName: defaults to <Table>_id
  Object: <OtherTable>
  ObjectName: defaults to <OtherTable>_id

You will need to ensure there are no conflicts when defining multiple relations, as the subject_name and object_name also become part of the exposed API.

from daptin.

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.