Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrations hang when "default=" is set on a new field, while USING HASH.

See original GitHub issue

Issue Description

What works.

First time table creation, and most other migrations work fine.

What does not work.

Migrations hang when default= is set on a new field, while USING HASH in the table.

message = models.TextField(default='') # Hangs migration.
message2 = models.TextField(null=True) # Works.

Issue Details

This issue is mentioned here:

I believe, when the migration has to perform a full rewrite of the table, Django cannot understand crdb_internal_id_shard_16 (or how it fits into the model) when USING HASH is specified.

Possible resolution

Is there a way to ignore or hide fields which CockroachDB generates automatically when using hash sharded index?

If we can get Django to simply ignore anything of crdb_internal_* we could be okay.

Related: 78049

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

rafisscommented, Aug 25, 2022

Thanks for this report! Could you share the way of reproducing the bug using only cockroach sql? And file an issue at (or post here, and I can file it for you).

timgrahamcommented, Aug 25, 2022

Great, thanks. Closing as “not completed” since it’s not applicable to this repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

default for serialized column in activerecord migration
When Rails serializes a hash to save in the db, all it does is convert it to YAML so that it can be...
Read more >
Understanding migrations with Room | by Florina Muntenescu
An important part in the migration internals is played by an identity hash String that is used by Room to uniquely identify every...
Read more >
sql: Use hash-sharded indexes by default · Issue #78049
Migrations hang when "default=" is set on a new field, while USING HASH. cockroachdb/django-cockroachdb#265. Closed. CRDB job hangs ...
Read more >
Avoiding downtime in migrations - GitLab Docs
To rename a column without requiring downtime, we need two migrations: a regular migration and a post-deployment migration. Both these migrations can go...
Read more >
Troubleshooting migration tasks in AWS Database Migration ...
To migrate secondary objects from your database, use the database's native tools if you are migrating to the same database engine as your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found