Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
83efc1a
Checkpoint before follow-up message
cursoragent Sep 29, 2025
9511964
Update rpath to include sqlpage directory for ODBC drivers
cursoragent Sep 29, 2025
3551434
Build: Add unixODBC build and cross-compilation support
cursoragent Sep 29, 2025
1b71bc4
Configure rpath for Linux targets and conditionalize odbc-sys
cursoragent Sep 29, 2025
493dd52
Merge branch 'main' into cursor/statically-link-unixodbc-and-update-c…
lovasoa Oct 2, 2025
df242b4
Refactor: Optimize dependencies and library paths in Dockerfile
cursoragent Oct 2, 2025
186686b
Add odbc feature and conditional odbc-sys dependency
cursoragent Oct 2, 2025
8866cf4
feat: Add ODBC build modes and documentation
cursoragent Oct 2, 2025
74fc9e6
Remove unused odbc-sys dependency
cursoragent Oct 2, 2025
4f50f41
Merge branch 'main' into cursor/statically-link-unixodbc-and-update-c…
lovasoa Oct 2, 2025
bbf0c8c
shorter agents rules
lovasoa Oct 2, 2025
6790c50
deps
lovasoa Oct 2, 2025
a2ad7bb
Refactor: Move odbc import to top of file
cursoragent Oct 2, 2025
515005c
truly static iodbc link
lovasoa Oct 3, 2025
25f8385
make odbc mandatory
lovasoa Oct 3, 2025
b8d3f28
windows build
lovasoa Oct 3, 2025
79502ff
iodbc -> unixodbc
lovasoa Oct 3, 2025
95315f6
Update ODBC driver configuration in CI and docker-compose for PostgreSQL
lovasoa Oct 3, 2025
8b85801
Update PostgreSQL ODBC driver configuration in CI workflow
lovasoa Oct 3, 2025
3bb7513
update driver path
lovasoa Oct 3, 2025
5fb17c6
update driver path
lovasoa Oct 3, 2025
a7ff6d6
Update ODBC dependency configuration and CI workflow to use all features
lovasoa Oct 4, 2025
719937b
remove rpath
lovasoa Oct 4, 2025
c5c0334
contributing
lovasoa Oct 4, 2025
6ceeb81
test with static odbc
lovasoa Oct 4, 2025
3cad946
documentation
lovasoa Oct 4, 2025
e186f13
instructions
lovasoa Oct 4, 2025
2c7cb90
add compatibility section to homepage
lovasoa Oct 4, 2025
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
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
# set by the user, and this is a good thing. If the user already set some
# LIBSQLITE3_FLAGS, he probably knows what he is doing.
LIBSQLITE3_FLAGS = "-DSQLITE_ENABLE_MATH_FUNCTIONS"

[build]
rustflags = []
20 changes: 5 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ jobs:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
- name: Install ODBC dependencies
run: |
sudo apt-get update
sudo apt-get install -y unixodbc-dev freetds-dev
- name: Set up cargo cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo test
- run: cargo test --all-features
- name: Upload Linux binary
uses: actions/upload-artifact@v4
with:
Expand All @@ -58,29 +54,23 @@ jobs:
db_url: "mssql://root:[email protected]/sqlpage"
- database: odbc
container: postgres
db_url: "Driver={PostgreSQL Unicode};Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!"
db_url: "Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!"
setup_odbc: true
steps:
- uses: actions/checkout@v4
- name: Set up cargo cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- name: Install ODBC dependencies
run: |
sudo apt-get update
sudo apt-get install -y unixodbc-dev freetds-dev
- name: Setup ODBC for testing
- name: Install PostgreSQL ODBC driver
if: matrix.setup_odbc
run: |
# Install PostgreSQL ODBC driver (automatically registers the driver)
sudo apt-get install -y odbc-postgresql
run: sudo apt-get install -y odbc-postgresql
- name: Start database container
run: docker compose up --wait ${{ matrix.container }}
- name: Show container logs
if: failure()
run: docker compose logs ${{ matrix.container }}
- name: Run tests against ${{ matrix.database }}
timeout-minutes: 5
run: cargo test
run: cargo test --all-features
env:
DATABASE_URL: ${{ matrix.db_url }}
RUST_BACKTRACE: 1
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:
- os: windows-latest
binary_extension: .exe
target: x86_64-pc-windows-msvc
features: ""
- os: macos-latest
target: x86_64-apple-darwin
features: "odbc-static"
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
Expand All @@ -35,7 +37,7 @@ jobs:
- name: Set up cargo cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- name: Build
run: cargo build --profile superoptimized --locked --target ${{ matrix.target }}
run: cargo build --profile superoptimized --locked --target ${{ matrix.target }} --features "${{ matrix.features }}"
- name: Upload unsigned Windows artifact
if: matrix.os == 'windows-latest'
id: upload_unsigned
Expand Down Expand Up @@ -83,18 +85,14 @@ jobs:
container: quay.io/pypa/manylinux_2_28_x86_64
steps:
- uses: actions/checkout@v4
- name: Install ODBC dependencies
run: |
yum update -y
yum install -y unixODBC-devel freetds-devel
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Set up cargo cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- name: Build
run: cargo build --profile superoptimized --locked --target x86_64-unknown-linux-gnu
run: cargo build --profile superoptimized --locked --target x86_64-unknown-linux-gnu --features "odbc-static"
- uses: actions/upload-artifact@v4
with:
name: sqlpage ubuntu-latest
Expand Down
36 changes: 7 additions & 29 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ HTML streamed to client

## Validation

### When working on rust code
Mandatory formatting (rust): `cargo fmt --all`

Mandatory linting: `cargo clippy --all-targets --all-features -- -D warnings`

### When working on css or js
Frontend formatting: `npm run format`

More about testing: see [github actions](./.github/workflows/ci.yml).
Project structure: see [contribution guide](./CONTRIBUTING.md)

Don’t reformat unrelated files. Always run tests/lints/format before stopping when you changed code.
NEVER reformat/lint/touch files unrelated to your task. Always run tests/lints/format before stopping when you changed code.

### Testing

Expand All @@ -32,33 +33,10 @@ DATABASE_URL='mssql://root:Password123!@localhost/sqlpage' cargo test # all dbms
- Components: defined in `./sqlpage/templates/*.handlebars`
- Functions: `src/webserver/database/sqlpage_functions/functions.rs` registered with `make_function!`.
- Components and functions are documented in [official website](./examples/official-site/sqlpage/migrations/); one migration per component and per function.
- ```sql
CREATE TABLE component(
name TEXT PRIMARY KEY,
description TEXT NOT NULL,
icon TEXT, -- icon name from tabler icon
introduced_in_version TEXT
);

CREATE TABLE parameter_type(name TEXT PRIMARY KEY);
INSERT INTO parameter_type(name) VALUES ('BOOLEAN'), ('COLOR'), ('HTML'), ('ICON'), ('INTEGER'), ('JSON'), ('REAL'), ('TEXT'), ('TIMESTAMP'), ('URL');

CREATE TABLE parameter(
top_level BOOLEAN DEFAULT FALSE,
name TEXT,
component TEXT REFERENCES component(name) ON DELETE CASCADE,
description TEXT,
description_md TEXT,
type TEXT REFERENCES parameter_type(name) ON DELETE CASCADE,
optional BOOLEAN DEFAULT FALSE,
);

CREATE TABLE example(
component TEXT REFERENCES component(name) ON DELETE CASCADE,
description TEXT,
properties JSON,
);
```
- tables
- `component(name,description,icon,introduced_in_version)` -- icon name from tabler icon
- `parameter(top_level BOOLEAN, name, component REFERENCES component(name), description, description_md, type, optional BOOLEAN)` parameter types: BOOLEAN, COLOR, HTML, ICON, INTEGER, JSON, REAL, TEXT, TIMESTAMP, URL
- `example(component REFERENCES component(name), description, properties JSON)`
- [Configuration](./configuration.md): see [AppConfig](./src/app_config.rs)
- Routing: file-based in `src/webserver/routing.rs`; not found handled via `src/default_404.sql`.
- Follow patterns from similar modules before introducing new abstractions.
Expand Down
24 changes: 21 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ cargo build --release

The resulting executable will be in `target/release/sqlpage`.

### ODBC build modes

SQLPage can either be built with an integrated odbc driver manager (static linking),
or depend on having one already installed on the system where it is running (dynamic linking).

- Dynamic ODBC (default): `cargo build`
- Static ODBC (Linux and MacOS only): `cargo build --features odbc-static`

Windows comes with ODBC pre-installed; SQLPage cannot statically link to the unixODBC driver manager on windows.

## Code Style and Linting

### Rust

- Use `cargo fmt` to format your Rust code
- Run `cargo clippy` to catch common mistakes and improve code quality
- All code must pass the following checks:

```bash
cargo fmt --all -- --check
cargo clippy
Expand All @@ -55,6 +67,7 @@ We use Biome for linting and formatting of the frontend code.
```bash
npx @biomejs/biome check .
```

This will check the entire codebase (html, css, js).

## Testing
Expand All @@ -80,6 +93,7 @@ cargo test
```

### End-to-End Tests

We use Playwright for end-to-end testing of dynamic frontend features.
Tests are located in [`tests/end-to-end/`](./tests/end-to-end/). Key areas covered include:

Expand All @@ -103,14 +117,15 @@ npm run test
## Documentation

### Component Documentation

When adding new components, comprehensive documentation is required. Example from a component documentation:

```sql
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
('component_name', 'icon_name', 'Description of the component', 'version');

-- Document all parameters
INSERT INTO parameter(component, name, description, type, top_level, optional)
INSERT INTO parameter(component, name, description, type, top_level, optional)
VALUES ('component_name', 'param_name', 'param_description', 'TEXT|BOOLEAN|NUMBER|JSON|ICON|COLOR', false, true);

-- Include usage examples
Expand All @@ -127,6 +142,7 @@ If you are editing an existing component, edit the existing sql documentation fi
If you are adding a new component, add a new sql file in the folder, and add the appropriate insert statements above.

### SQLPage Function Documentation

When adding new SQLPage functions, document them using a SQL migrations. Example structure:

```sql
Expand Down Expand Up @@ -168,6 +184,7 @@ VALUES (
```

Key elements to include in function documentation:

- Clear description of the function's purpose
- Version number where the function was introduced
- Appropriate icon
Expand All @@ -179,11 +196,13 @@ Key elements to include in function documentation:
## Pull Request Process

1. Create a new branch for your feature/fix:

```bash
git checkout -b feature/your-feature-name
```

2. Make your changes, ensuring:

- All tests pass
- Code is properly formatted
- New features are documented
Expand All @@ -199,11 +218,10 @@ git checkout -b feature/your-feature-name
- Run frontend linting with Biome
- Test against multiple databases (PostgreSQL, MySQL, MSSQL)

5. Wait for review and address any feedback

## Release Process

Releases are automated when pushing tags that match the pattern `v*` (e.g., `v1.0.0`). The CI pipeline will:

- Build and test the code
- Create Docker images for multiple architectures
- Push images to Docker Hub
Expand Down
47 changes: 24 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading