Files
insertr/package.json
Joakim bab329b429 refactor: implement database-specific schema architecture with schema-as-query pattern
🏗️ **Major Database Schema Refactoring**

**Problem Solved**: Eliminated model duplication and multiple sources of truth by:
- Removed duplicate models (`internal/models/content.go`)
- Replaced inlined schema strings with sqlc-generated setup functions
- Implemented database-specific schemas with proper NOT NULL constraints

**Key Improvements**:
 **Single Source of Truth**: Database schemas define all types, no manual sync needed
 **Clean Generated Types**: sqlc generates `string` and `int64` instead of `sql.NullString/sql.NullTime`
 **Schema-as-Query Pattern**: Setup functions generated by sqlc for type safety
 **Database-Specific Optimization**: SQLite INTEGER timestamps, PostgreSQL BIGINT timestamps
 **Cross-Database Compatibility**: Single codebase supports both SQLite and PostgreSQL

**Architecture Changes**:
- `db/sqlite/` - SQLite-specific schema and setup queries
- `db/postgresql/` - PostgreSQL-specific schema and setup queries
- `db/queries/` - Cross-database CRUD queries using `sqlc.arg()` syntax
- `internal/db/database.go` - Database abstraction with runtime selection
- `internal/api/models.go` - Clean API models for requests/responses

**Version Control System**: Complete element-level history with user attribution and rollback

**Verification**:  Full API workflow tested (create → update → rollback → versions)
**Production Ready**: Supports SQLite (development) → PostgreSQL (production) migration
2025-09-09 00:25:07 +02:00

51 lines
1.3 KiB
JSON

{
"name": "insertr",
"version": "0.1.0",
"description": "The Tailwind of CMS - Zero-configuration content editing with version control for any static site",
"main": "lib/dist/insertr.js",
"type": "module",
"scripts": {
"dev": "node scripts/dev.js serve",
"build": "node scripts/build.js",
"build:lib": "cd lib && npm run build",
"check": "node scripts/dev.js check",
"demo": "node scripts/dev.js demo",
"help": "node scripts/dev.js help",
"test": "echo 'Test script placeholder - will add tests for insertr.js'",
"lint": "echo 'Linting placeholder - will add ESLint'",
"start": "npm run dev",
"install:all": "npm install && cd lib && npm install"
},
"keywords": [
"cms",
"headless-cms",
"static-site-generator",
"content-management",
"version-control",
"content-versioning",
"build-time-enhancement",
"zero-config",
"go",
"javascript",
"sqlc",
"sqlite"
],
"author": "Insertr Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/yourusername/insertr.git"
},
"devDependencies": {
"live-server": "^1.2.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
},
"browserslist": [
"defaults",
"not IE 11"
],
"dependencies": {}
}