-
-
Notifications
You must be signed in to change notification settings - Fork 0
Scripts.md
This document describes the CLI helper scripts available in the /scripts directory.
| Script | Purpose |
|---|---|
create-migration.sh |
Entity Framework Core migration management |
update-tabler.sh |
Update Tabler UI framework assets |
A helper script for managing Entity Framework Core migrations.
scripts/create-migration.sh
- .NET SDK 9.0.300+
- EF Core CLI tools installed globally
Install EF Core tools if needed:
dotnet tool install --global dotnet-ef./scripts/create-migration.sh <MigrationName> [--apply]
./scripts/create-migration.sh --remove./scripts/create-migration.sh AddPaymentIndexThis creates a new migration file in src/OpenCashFlow.Shared/Data/Migrations/.
Output:
Creating migration: AddPaymentIndex
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'
./scripts/create-migration.sh AddPaymentIndex --applyThis creates the migration and immediately applies it to the database.
Output:
Creating migration: AddPaymentIndex
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'
Applying migration...
Applying migration '20260124150000_AddPaymentIndex'.
Done.
./scripts/create-migration.sh --removeThis removes the most recent unapplied migration.
Output:
Removing last migration...
Removing migration '20260124150000_AddPaymentIndex'.
Done.
The script uses these hardcoded paths:
PROJECT="src/OpenCashFlow.Shared/OpenCashFlow.Shared.csproj"
STARTUP_PROJECT="src/OpenCashFlow.API/OpenCashFlow.API.csproj"
CONTEXT="ApplicationDbContext"
OUTPUT_DIR="Data/Migrations"If you prefer to run commands manually:
Create migration:
dotnet ef migrations add <MigrationName> \
--project src/OpenCashFlow.Shared/OpenCashFlow.Shared.csproj \
--startup-project src/OpenCashFlow.API/OpenCashFlow.API.csproj \
--context ApplicationDbContext \
--output-dir Data/MigrationsApply migrations:
dotnet ef database update \
--project src/OpenCashFlow.Shared/OpenCashFlow.Shared.csproj \
--startup-project src/OpenCashFlow.API/OpenCashFlow.API.csproj \
--context ApplicationDbContextRemove last migration:
dotnet ef migrations remove \
--project src/OpenCashFlow.Shared/OpenCashFlow.Shared.csproj \
--startup-project src/OpenCashFlow.API/OpenCashFlow.API.csproj \
--context ApplicationDbContextUse clear, descriptive names:
| Pattern | Example | Use Case |
|---|---|---|
Add<Entity> |
AddCashLedger |
New table |
Add<Entity><Column> |
AddPaymentDescription |
New column |
Remove<Entity><Column> |
RemoveUserMiddleName |
Drop column |
Rename<Old>To<New> |
RenameEmailToContactEmail |
Rename column |
Add<Entity>Index |
AddPaymentDateIndex |
New index |
Update<Entity> |
UpdateCompanySchema |
Multiple changes |
Ensure the projects compile successfully:
dotnet build src/OpenCashFlow.Shared/OpenCashFlow.Shared.csproj
dotnet build src/OpenCashFlow.API/OpenCashFlow.API.csprojCheck that:
- The connection string is set in environment or
appsettings.json - PostgreSQL is running
- The database exists
Migration names must be unique. Use a different name or remove the existing migration first.
A script to update the Tabler UI framework to the latest version.
scripts/update-tabler.sh
Downloads and extracts the latest Tabler release to /templates/tabler/core/.
./scripts/update-tabler.sh- Downloads the latest Tabler release from GitHub
- Extracts to
/templates/tabler/core/ - Copies relevant assets to
src/OpenCashFlow.App/wwwroot/vendor/tabler/
If the script doesn't work, update manually:
- Download from https://github.com/tabler/tabler/releases
- Extract the archive
- Copy CSS files to
wwwroot/vendor/tabler/css/ - Copy JS files to
wwwroot/vendor/tabler/js/ - Copy fonts to
wwwroot/vendor/tabler/fonts/
wwwroot/vendor/tabler/
├── css/
│ ├── tabler.min.css
│ └── tabler-vendors.min.css
├── js/
│ ├── tabler.min.js
│ └── tabler-vendors.min.js
└── fonts/
└── (icon fonts)
Ensure scripts are executable:
chmod +x scripts/create-migration.sh
chmod +x scripts/update-tabler.shWhen adding new scripts:
- Place them in the
/scriptsdirectory - Use
.shextension for bash scripts - Add a shebang line:
#!/bin/bash - Make them executable
- Document them in this file
#!/bin/bash
# Script Name: my-script.sh
# Purpose: Brief description of what this script does
# Usage: ./scripts/my-script.sh [arguments]
set -e # Exit on error
# Configuration
VARIABLE="value"
# Functions
function show_usage() {
echo "Usage: $0 [arguments]"
echo " argument1 Description of argument 1"
echo " --help Show this help message"
}
# Main logic
if [ "$1" == "--help" ]; then
show_usage
exit 0
fi
echo "Executing script..."
# Your commands here
echo "Done."For CI/CD automation, see .github/workflows/. The GitHub Actions workflows handle:
- Building and testing on PR/push
- Creating release artifacts
- Deploying to staging/production
These are not in /scripts as they're GitHub-specific configurations rather than developer-run scripts.
Project status
OpenCashFlow is under active development.
APIs, database schema, and UI may change until the first stable release.
Built with
.NET · ASP.NET Core · Entity Framework Core · PostgreSQL · Tabler
© 2026 OpenCashFlow
- Developer Preview
- Not production-ready
- First-run setup included