Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions my-sonicjs-app/migrations/032_form_content_integration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Migration 032: Form-Content Integration
-- Adds bridge columns to link forms to collections and submissions to content items

-- Add source_type and source_id to collections for form-derived collections
ALTER TABLE collections ADD COLUMN source_type TEXT DEFAULT 'user';
ALTER TABLE collections ADD COLUMN source_id TEXT;

-- Index for efficient lookup of form-derived collections
CREATE INDEX IF NOT EXISTS idx_collections_source ON collections(source_type, source_id);

-- Add content_id to form_submissions for linking to content items
ALTER TABLE form_submissions ADD COLUMN content_id TEXT REFERENCES content(id);

-- Index for efficient lookup by content_id
CREATE INDEX IF NOT EXISTS idx_form_submissions_content_id ON form_submissions(content_id);

-- Create system user for anonymous form submissions
INSERT OR IGNORE INTO users (id, email, username, first_name, last_name, password_hash, role, is_active, created_at, updated_at)
VALUES ('system-form-submission', 'system-forms@sonicjs.internal', 'system-forms', 'Form', 'Submission', NULL, 'viewer', 0, strftime('%s','now') * 1000, strftime('%s','now') * 1000);
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,13 @@ CREATE INDEX IF NOT EXISTS idx_forms_turnstile ON forms(turnstile_enabled);
filename: "031_ai_search_plugin.sql",
description: "Migration 031: Ai Search Plugin",
sql: "-- AI Search plugin settings\nCREATE TABLE IF NOT EXISTS ai_search_settings (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n enabled BOOLEAN DEFAULT 0,\n ai_mode_enabled BOOLEAN DEFAULT 1,\n selected_collections TEXT, -- JSON array of collection IDs to index\n dismissed_collections TEXT, -- JSON array of collection IDs user chose not to index\n autocomplete_enabled BOOLEAN DEFAULT 1,\n cache_duration INTEGER DEFAULT 1, -- hours\n results_limit INTEGER DEFAULT 20,\n index_media BOOLEAN DEFAULT 0,\n index_status TEXT, -- JSON object with status per collection\n last_indexed_at INTEGER,\n created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER DEFAULT (strftime('%s', 'now') * 1000)\n);\n\n-- Search history/analytics\nCREATE TABLE IF NOT EXISTS ai_search_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n query TEXT NOT NULL,\n mode TEXT, -- 'ai' or 'keyword'\n results_count INTEGER,\n user_id INTEGER,\n created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000)\n);\n\n-- Index metadata tracking (per collection)\nCREATE TABLE IF NOT EXISTS ai_search_index_meta (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n collection_id INTEGER NOT NULL,\n collection_name TEXT NOT NULL, -- Cache collection name for display\n total_items INTEGER DEFAULT 0,\n indexed_items INTEGER DEFAULT 0,\n last_sync_at INTEGER,\n status TEXT DEFAULT 'pending', -- 'pending', 'indexing', 'completed', 'error'\n error_message TEXT,\n UNIQUE(collection_id)\n);\n\n-- Indexes for performance\nCREATE INDEX IF NOT EXISTS idx_ai_search_history_created_at ON ai_search_history(created_at);\nCREATE INDEX IF NOT EXISTS idx_ai_search_history_mode ON ai_search_history(mode);\nCREATE INDEX IF NOT EXISTS idx_ai_search_index_meta_collection_id ON ai_search_index_meta(collection_id);\nCREATE INDEX IF NOT EXISTS idx_ai_search_index_meta_status ON ai_search_index_meta(status);\n"
},
{
id: "032",
name: "Form Content Integration",
filename: "032_form_content_integration.sql",
description: "Migration 032: Form Content Integration",
sql: "-- Migration 032: Form-Content Integration\n-- Adds bridge columns to link forms to collections and submissions to content items\n\n-- Add source_type and source_id to collections for form-derived collections\nALTER TABLE collections ADD COLUMN source_type TEXT DEFAULT 'user';\nALTER TABLE collections ADD COLUMN source_id TEXT;\n\n-- Index for efficient lookup of form-derived collections\nCREATE INDEX IF NOT EXISTS idx_collections_source ON collections(source_type, source_id);\n\n-- Add content_id to form_submissions for linking to content items\nALTER TABLE form_submissions ADD COLUMN content_id TEXT REFERENCES content(id);\n\n-- Index for efficient lookup by content_id\nCREATE INDEX IF NOT EXISTS idx_form_submissions_content_id ON form_submissions(content_id);\n\n-- Create system user for anonymous form submissions\nINSERT OR IGNORE INTO users (id, email, username, first_name, last_name, password_hash, role, is_active, created_at, updated_at)\nVALUES ('system-form-submission', 'system-forms@sonicjs.internal', 'system-forms', 'Form', 'Submission', NULL, 'viewer', 0, strftime('%s','now') * 1000, strftime('%s','now') * 1000);\n"
}
];
var migrationsByIdMap = new Map(
Expand Down Expand Up @@ -2108,5 +2115,5 @@ var MigrationService = class {
};

exports.MigrationService = MigrationService;
//# sourceMappingURL=chunk-2YRNPIU4.cjs.map
//# sourceMappingURL=chunk-2YRNPIU4.cjs.map
//# sourceMappingURL=chunk-2JX5LHCH.cjs.map
//# sourceMappingURL=chunk-2JX5LHCH.cjs.map
1 change: 1 addition & 0 deletions packages/core/dist/chunk-2JX5LHCH.cjs.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-2YRNPIU4.cjs.map

This file was deleted.

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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function buildQuery(table, filter) {
// package.json
var package_default = {
name: "@sonicjs-cms/core",
version: "2.7.0",
version: "2.8.0",
description: "Core framework for SonicJS headless CMS - Edge-first, TypeScript-native CMS built for Cloudflare Workers",
type: "module",
main: "./dist/index.cjs",
Expand Down Expand Up @@ -617,5 +617,5 @@ exports.renderTemplate = renderTemplate;
exports.sanitizeInput = sanitizeInput;
exports.sanitizeObject = sanitizeObject;
exports.templateRenderer = templateRenderer;
//# sourceMappingURL=chunk-DMZI7OU3.cjs.map
//# sourceMappingURL=chunk-DMZI7OU3.cjs.map
//# sourceMappingURL=chunk-5HMR2SJW.cjs.map
//# sourceMappingURL=chunk-5HMR2SJW.cjs.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-5PH7K7YR.js.map

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-5TO3OUFT.cjs.map

This file was deleted.

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

1 change: 1 addition & 0 deletions packages/core/dist/chunk-5X6HGGYW.js.map

Large diffs are not rendered by default.

243 changes: 0 additions & 243 deletions packages/core/dist/chunk-6RABGLOO.cjs

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-6RABGLOO.cjs.map

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-6STHJAKU.cjs.map

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/dist/chunk-7DU5PUKL.js.map

This file was deleted.

Loading