Prerequisites
Before setting up the TechCore database, ensure you have:- SQL Server 2016 or later (Express, Standard, or Enterprise)
- SQL Server Management Studio (SSMS) or Azure Data Studio
- Appropriate permissions to create databases and tables
- .NET 8.0 SDK (for running the application)
Installation Methods
You can set up the TechCore database using either of these methods:SQL Script
Execute the provided SQL script for manual setup
Entity Framework Migrations
Use EF Core migrations (if available in your deployment)
Method 1: SQL Script Installation
This is the recommended method for initial setup and production deployments.Locate the SQL Script
The database creation script is located at:This script contains all necessary DDL statements to create the complete database schema.
Open SQL Server Management Studio
Launch SSMS and connect to your SQL Server instance:
- Server name:
.(local instance) or your server address - Authentication: Windows Authentication or SQL Server Authentication
- Click Connect
Execute the Database Creation Script
- Using SSMS
- Using sqlcmd
- Using Azure Data Studio
- Click File → Open → File
- Navigate to
TechCoreQuery.sqland open it - Review the script contents
- Click Execute (F5) to run the entire script
- Check the Messages tab for any errors
Verify Database Creation
Confirm the database and all objects were created successfully:You should see:
- 12 tables (abonosVentas, categoria, clientes, compras, comprasDetalle, planPagos, productos, proveedores, rol, users, ventas, ventasDetalle)
- 3 views (vw_CuotasPorVencer, vw_CuotasVencidas, vw_EstadoCuenta)
- 2 triggers (TR_ActualizarSaldo, TR_DisminuirStock)
Method 2: Entity Framework Migrations
If your deployment includes EF Core migrations:The SQL script method is preferred as it includes all indexes, triggers, and views that may not be fully represented in EF migrations.
Configuration
Connection String Setup
After creating the database, configure the connection string in your application.Initial Data Population
After database creation, you’ll need to populate initial data:Create Default Roles
Create First User
Create Sample Categories
Database Maintenance
Backup Recommendations
Configure Automatic Backups
Set up SQL Server backup jobs for:
- Full backup: Daily at 2:00 AM
- Differential backup: Every 6 hours
- Transaction log backup: Every 15 minutes (if using Full recovery model)
Index Maintenance
Rebuild indexes monthly to maintain performance:Monitor Database Size
Troubleshooting
Error: Database 'TechCore' already exists
Error: Database 'TechCore' already exists
If you need to recreate the database:Then re-run the creation script.
Error: Cannot open database requested by the login
Error: Cannot open database requested by the login
Verify your user has access:
Error: Login failed for user 'NT AUTHORITY\\NETWORK SERVICE'
Error: Login failed for user 'NT AUTHORITY\\NETWORK SERVICE'
Connection Timeout Errors
Connection Timeout Errors
Increase the timeout in your connection string:
Security Hardening
Create Application User with Limited Permissions
Enable Transparent Data Encryption (Optional)
For sensitive data protection:Next Steps
Entity Reference
Learn about all database entities and their relationships
Database Overview
Understand the database architecture and design decisions