1

I'm creating my database tables inside a flask application via SQLAlchemy. According to this answer, my code should look like this:

id = db.Column(db.CHAR(36), primary_key=True, server_default=str("uuid_generate_v4()"))

which, after migrations and upgrades are done, its definition on the database looks like this:

 id character(36) COLLATE pg_catalog."default" NOT NULL DEFAULT 'uuid_generate_v4()'::bpchar,

Is this the correct way of specifying a UUID default value in PSQL?

codeninja
  • 129
  • 3
  • 7

0 Answers0