0.1.16 • Published 8 months ago

@linkbcms/database v0.1.16

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@linkbcms/database

Database module for the LinkB CMS, providing database schema generation and management functionality.

Features

  • Database adapters for PostgreSQL (and future support for other databases)
  • Schema generation from CMS configuration
  • Migration management
  • Database utilities for connecting and interacting with the database

Installation

npm install @linkbcms/database

Usage

Basic usage

import { execute } from '@linkbcms/database';

// Execute a database action
await execute('gen-schema', {
  databaseType: 'postgres',
  connectionString: 'postgresql://user:password@localhost:5432/mydb',
  schemaDir: './database/schema',
  migrationDir: './database/migrations',
  configPath: './cms.config.tsx'
});

Available actions

  • gen-schema: Generate database schema based on CMS configuration
  • migrate: Run pending migrations
  • test-connection: Test database connectivity
  • reset: Reset database by dropping all tables

API Reference

execute(action, options)

Execute a database action with the specified options.

Parameters:

  • action: The action to execute (string)
  • options: Configuration options object:
    • workspaceRoot: Root directory of the workspace
    • databaseType: Type of database to connect to
    • connectionString: Database connection string
    • schema: Database schema name
    • schemaDir: Directory for schema files
    • migrationDir: Directory for migration files
    • configPath: Path to the CMS configuration file
    • loadConfigFn: Function to load the CMS configuration

License

MIT

0.1.16

8 months ago

0.1.15

8 months ago

0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

8 months ago

0.1.10

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago