Skip to content

Feature/edit table generated columns - #4228

Open
deepsidhu1313 wants to merge 5 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/edit-table-generated-columns
Open

deepsidhu1313 wants to merge 5 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/edit-table-generated-columns

Conversation

@deepsidhu1313

Copy link
Copy Markdown
Contributor

Add SQL round trip tests for VIRTUAL and STORED generated columns and a
test that Field/Table comparison notices changes to the generated column
definition (alterTable relies on it to detect modified tables).

Add an offscreen test (test-edit-table) which drives the Edit Table
dialog against a real database: showing, adding, changing and removing
generated columns, switching between VIRTUAL and STORED, adding a STORED
column to a table with data, and the primary key / default value
restrictions. These fail for now as the dialog has no support for
generated columns yet.

Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com

Add SQL round trip tests for VIRTUAL and STORED generated columns and a
test that Field/Table comparison notices changes to the generated column
definition (alterTable relies on it to detect modified tables).

Add an offscreen test (test-edit-table) which drives the Edit Table
dialog against a real database: showing, adding, changing and removing
generated columns, switching between VIRTUAL and STORED, adding a STORED
column to a table with data, and the primary key / default value
restrictions. These fail for now as the dialog has no support for
generated columns yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add a "Generated" column to the field list which holds the expression of
a generated column (empty for ordinary columns) and a "Stored" checkbox
column which switches the column from VIRTUAL, the default, to STORED.
Both are filled from the existing table and applied to the field when
edited. See sqlitebrowser#2107.

Generated columns can't be part of the primary key and can't have a
default value, so the dialog refuses these combinations. Turning an
existing column into a generated column replaces its data, so the user
has to confirm that first.

SQLite can't add a STORED column with ALTER TABLE ADD COLUMN, so
alterTable() now leaves those to the table rebuild it does anyway.

Field::operator== ignored the generated column constraint which made
alterTable() believe nothing had changed when only the generated column
expression or storage was edited. Compare it by value now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test-global-filter needs the CMake prefix paths on PATH on Windows
because the CI jobs build SQLite as a DLL there. test-edit-table links
SQLite too and would crash on Windows without them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The .ui files connect to slots that don't exist in Qt6 (QDialog::help)
unless uic generates string based connections. The main target already
sets this option for Qt6, but test-edit-table compiles the dialogs' .ui
files as well and would fail to build with Qt6.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Link CipherDialog into test-edit-table, which sqlitedb.cpp needs when it
is built with SQLCipher. Skip the three tests that have the dialog show
a message box on Windows, where QMessageBox::showEvent() crashes with the
offscreen platform.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants