Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ existing tools and performs at any scale.
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://www.heroku.com/deploy/?template=https://github.com/baserow/baserow/tree/master)

```bash
docker run -v baserow_data:/baserow/data -p 80:80 -p 443:443 baserow/baserow:2.0.5
docker run -v baserow_data:/baserow/data -p 80:80 -p 443:443 baserow/baserow:2.0.6
```

![Baserow database screenshot](docs/assets/screenshot.png "Baserow database screenshot")
Expand Down Expand Up @@ -116,7 +116,7 @@ Created by Baserow B.V. - bram@baserow.io.

Distributes under the MIT license. See `LICENSE` for more information.

Version: 2.0.5
Version: 2.0.6

The official repository can be found at https://github.com/baserow/baserow.

Expand Down
2 changes: 1 addition & 1 deletion backend/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail
# ENVIRONMENT VARIABLES USED DIRECTLY BY THIS ENTRYPOINT
# ======================================================

export BASEROW_VERSION="2.0.5"
export BASEROW_VERSION="2.0.6"

# Used by docker-entrypoint.sh to start the dev server
# If not configured you'll receive this: CommandError: "0.0.0.0:" is not a valid port number or address:port pair.
Expand Down
2 changes: 1 addition & 1 deletion backend/src/baserow/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
"name": "MIT",
"url": "https://github.com/baserow/baserow/blob/develop/LICENSE",
},
"VERSION": "2.0.5",
"VERSION": "2.0.6",
"SERVE_INCLUDE_SCHEMA": False,
"TAGS": [
{"name": "Settings"},
Expand Down
35 changes: 35 additions & 0 deletions backend/src/baserow/contrib/database/db/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,41 @@ def delete_model(self, model):
):
self.deferred_sql.remove(sql)

def ensure_single_column_index(self, model, field):
"""
Ensure an index exists on model(field.column). Safe to call repeatedly.
"""

# If any index/constraint exists that is backed by an index on exactly this
# column, don't create another.
if self._constraint_names(model, [field.column], index=True):
return

stmt = self._create_index_sql(model, fields=[field])
self.execute(stmt, params=None)

def ensure_m2m_field_indexes(self, field):
if field.many_to_many and field.remote_field.through._meta.auto_created:
through = field.remote_field.through
# Ensure the two FK indexes exist (especially important for the "reverse"
# FK). m2m_field_name() / m2m_reverse_field_name() return the
# through-field names.
for through_field_name in (
field.m2m_field_name(),
field.m2m_reverse_field_name(),
):
fk_field = through._meta.get_field(through_field_name)
self.ensure_single_column_index(through, fk_field)

def add_field(self, model, field):
return_value = super().add_field(model, field)
# Using the `create_model` to create a Baserow table, like what we do on
# `import_serialize` does actually create the indexes of the through table.
# However, when using `add_field` it does not. The code below will make sure
# that the needed indexes are created.
self.ensure_m2m_field_indexes(field)
return return_value


@contextlib.contextmanager
def safe_django_schema_editor(atomic=True, name=None, classes=None, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.0.14 on 2025-12-19 21:52

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("database", "0201_increase_pendingsearchvalueupdate_statistics"),
]

operations = [
migrations.AddField(
model_name="table",
name="missing_m2m_indexes_added",
field=models.BooleanField(
db_default=False,
default=True,
help_text="Indicates whether potentially missing m2m foreign key indexes have been added.",
),
),
]
14 changes: 14 additions & 0 deletions backend/src/baserow/contrib/database/table/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,20 @@ class Table(
null=True,
help_text="Indicates whether the table has had the field_rules_are_valid column added.",
)
# The m2m indexes of the foreign keys were not added before because the
# `schema_editor.add_field` does not add them. The `schema_editor.create_model`
# does add those. This problem has been addressed, but there are tables out there
# without those indexes.
missing_m2m_indexes_added = models.BooleanField(
# The `db_default` must be false because this is used when an entry is created
# no default value is set. This is what happens when the field index changes
# are not yet deployed, so index does not exist.
db_default=False,
# However, if the field index changes are deployed, this default value is used,
# and in that case, the index has been applied.
default=True,
help_text="Indicates whether potentially missing m2m foreign key indexes have been added.",
)

class Meta:
ordering = ("order",)
Expand Down
19 changes: 19 additions & 0 deletions backend/src/baserow/contrib/database/table/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ def setup_created_by_and_last_modified_by_column(self, table_id: int):
TableHandler().create_created_by_and_last_modified_by_fields(table)


@app.task(bind=True, queue="export")
def setup_m2m_field_indexes_if_not_exist(self, table_id: int):
from baserow.contrib.database.db.schema import safe_django_schema_editor
from baserow.contrib.database.table.handler import TableHandler

with transaction.atomic():
table = TableHandler().get_table_for_update(table_id)
model = table.get_model()
fields = model.get_fields()

with safe_django_schema_editor(atomic=False) as schema_editor:
for field in fields:
model_field = model._meta.get_field(field.db_column)
schema_editor.ensure_m2m_field_indexes(model_field)

table.missing_m2m_indexes_added = True
table.save(update_fields=["missing_m2m_indexes_added"])


@app.task(bind=True)
def update_table_usage(self, table_id: int, row_count: int = 0):
from baserow.contrib.database.table.handler import TableUsageHandler
Expand Down
3 changes: 3 additions & 0 deletions backend/src/baserow/contrib/database/views/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def update_view_index_if_view_group_by_changes(sender, view_group_by, **kwargs):
def view_loaded_create_indexes_and_columns(sender, view, table_model, **kwargs):
from baserow.contrib.database.table.tasks import (
setup_created_by_and_last_modified_by_column,
setup_m2m_field_indexes_if_not_exist,
)
from baserow.contrib.database.views.handler import ViewIndexingHandler

Expand All @@ -88,6 +89,8 @@ def view_loaded_create_indexes_and_columns(sender, view, table_model, **kwargs):
table = view.table
if not table.last_modified_by_column_added or not table.created_by_column_added:
setup_created_by_and_last_modified_by_column.delay(table_id=view.table.id)
if not table.missing_m2m_indexes_added:
setup_m2m_field_indexes_if_not_exist.delay(table_id=view.table_id)


@receiver(field_signals.fields_type_changed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def formulas_to_resolve(self, service: CoreRouterService) -> list[FormulaToResol
FormulaToResolve(
f"edge_{edge.uid}",
edge.condition,
lambda x: ensure_boolean(x, True),
lambda x: ensure_boolean(x, False),
f'edge "{edge.label}" condition',
)
for edge in service.edges.all()
Expand Down
2 changes: 1 addition & 1 deletion backend/src/baserow/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.0.5"
VERSION = "2.0.6"
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ def test_update_core_router_service(data_fixture):


@pytest.mark.django_db
def test_core_router_service_type_dispatch_data_with_a_truthful_edge(data_fixture):
@pytest.mark.parametrize(
"truthful_condition",
[1, [1], True, "yes"],
)
def test_core_router_service_type_dispatch_data_with_a_truthful_edge(
data_fixture, truthful_condition
):
service = data_fixture.create_core_router_service()
data_fixture.create_core_router_service_edge(
service=service, label="Edge 1", condition="'false'", skip_output_node=True
)
edge2 = data_fixture.create_core_router_service_edge(
service=service, label="Edge 2", condition="'true'", skip_output_node=True
service=service,
label="Edge 2",
condition=f"'{truthful_condition}'",
skip_output_node=True,
)

service_type = service.get_type()
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## Released 2.0.6

### New features
* [Core] Added more advanced formulas. [#4318](https://github.com/baserow/baserow/-/issues/4318)
* [Core] Allow array properties to be selected in the formula context when expert mode is selected. [#4485](https://github.com/baserow/baserow/-/issues/4485)

### Bug fixes
* [Builder] Resolve an issue with styling button fields in table elements. [#4494](https://github.com/baserow/baserow/-/issues/4494)
* [Database] Ensure m2m field indexes are all set.
* [Database] Prevent creating a new constraint when the enter key of the default value is pressed.


## Released 2.0.5

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "bug",
"message": "Resolve an issue with styling button fields in table elements.",
"issue_origin": "github",
"issue_number": 4494,
"domain": "builder",
"bullet_points": [],
"created_at": "2025-12-22"
}
9 changes: 9 additions & 0 deletions changelog/entries/2.0.6/bug/ensure_m2m_indexes_are_set.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "bug",
"message": "Ensure m2m field indexes are all set.",
"issue_origin": "github",
"issue_number": null,
"domain": "database",
"bullet_points": [],
"created_at": "2025-12-19"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "bug",
"message": "Prevent creating a new constraint when the enter key of the default value is pressed.",
"issue_origin": "github",
"issue_number": null,
"domain": "database",
"bullet_points": [],
"created_at": "2025-12-22"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "feature",
"message": "Allow array properties to be selected in the formula context when expert mode is selected.",
"issue_origin": "github",
"issue_number": 4485,
"domain": "core",
"bullet_points": [],
"created_at": "2025-12-19"
}
4 changes: 4 additions & 0 deletions changelog/releases.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"releases": [
{
"name": "2.0.6",
"created_at": "2025-12-22"
},
{
"name": "2.0.5",
"created_at": "2025-12-17"
Expand Down
Loading
Loading