GithubHelp home page GithubHelp logo

shortid-doctrine's People

Contributors

dependabot-preview[bot] avatar garak avatar spackmat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

flyingdr tacman

shortid-doctrine's Issues

Collation utf8_bin is not portable and breaks @Column annotation

For instance, Postgres by default does not know this collation and fails with:

SQLSTATE[42704]: Undefined object: 7 ERROR:  collation "utf8_bin" for encoding "UTF8" does not exist `.

By default it does accept C.UTF-8 or... default.

By hardcoding this value, you limit use cases to MySQL with imposed collation and break Doctrine's @Column collation support.

Specifing collation in @Column renders invalid SQL

/**
 * @ORM\Column(type="shortid", options={"collation": "C.UTF-8"})
 */

renders SQL like that:

CHAR(7) COLLATE "utf8_bin" NOT NULL COLLATE "C.UTF-8"

As a short-term workaround, it's possible to prepend migration with:

CREATE COLLATION IF NOT EXISTS utf8_bin FROM "C.UTF-8";

But this solution breaks migrations atomicity.

Are shortid collisions handled in any way?

Hi,

I read through the code and now I am not sure, if possible ID collisions are detected or actively avoided? I found this answer on stackoverflow suggesting a method how to actively avoid collisions with existing entities. Now I'm wondering, if Doctine itself handles such collisions internally?

Collisions are very rare, but there is a chance rising with every extisting entity, so checking the generated shortid looks like a good idea.

Any ideas on this?

add generator

Add a generator to use with GeneratedValue option

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.