0.1.16 • Published 10 months ago

@linkbcms/database v0.1.16

Weekly downloads
-
License
MIT
Repository
-
Last release
10 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

10 months ago

0.1.15

10 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago