forked from aiolabs/libra
Rename Castle Accounting extension to Libra
Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).
Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).
No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c577c740c
commit
c174cda48d
44 changed files with 953 additions and 953 deletions
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
Castle Extension Database Migrations
|
||||
Libra Extension Database Migrations
|
||||
|
||||
This file contains a single squashed migration that creates the complete
|
||||
database schema for the Castle extension.
|
||||
database schema for the Libra extension.
|
||||
|
||||
MIGRATION HISTORY:
|
||||
This is a squashed migration that combines m001-m016 from the original
|
||||
|
|
@ -39,19 +39,19 @@ Original migration sequence (Nov 2025):
|
|||
|
||||
async def m001_initial(db):
|
||||
"""
|
||||
Initial Castle database schema (squashed from m001-m016).
|
||||
Initial Libra database schema (squashed from m001-m016).
|
||||
|
||||
Creates complete database structure for Castle accounting extension:
|
||||
Creates complete database structure for Libra accounting extension:
|
||||
- Accounts: Chart of accounts with hierarchical Beancount-style names
|
||||
- Extension settings: Castle-wide configuration
|
||||
- Extension settings: Libra-wide configuration
|
||||
- User wallet settings: Per-user wallet configuration
|
||||
- Manual payment requests: User-submitted payment requests to Castle
|
||||
- Manual payment requests: User-submitted payment requests to Libra
|
||||
- Balance assertions: Reconciliation and balance checking
|
||||
- User equity status: Equity contribution eligibility
|
||||
- Account permissions: Granular access control
|
||||
|
||||
Note: Journal entries are managed by Fava/Beancount (external source of truth).
|
||||
Castle submits entries to Fava and queries Fava for journal data.
|
||||
Libra submits entries to Fava and queries Fava for journal data.
|
||||
"""
|
||||
|
||||
# =========================================================================
|
||||
|
|
@ -89,15 +89,15 @@ async def m001_initial(db):
|
|||
# =========================================================================
|
||||
# EXTENSION SETTINGS TABLE
|
||||
# =========================================================================
|
||||
# Castle-wide configuration settings
|
||||
# Libra-wide configuration settings
|
||||
|
||||
await db.execute(
|
||||
f"""
|
||||
CREATE TABLE extension_settings (
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
castle_wallet_id TEXT,
|
||||
libra_wallet_id TEXT,
|
||||
fava_url TEXT NOT NULL DEFAULT 'http://localhost:3333',
|
||||
fava_ledger_slug TEXT NOT NULL DEFAULT 'castle-ledger',
|
||||
fava_ledger_slug TEXT NOT NULL DEFAULT 'libra-ledger',
|
||||
fava_timeout REAL NOT NULL DEFAULT 10.0,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
|
||||
);
|
||||
|
|
@ -122,7 +122,7 @@ async def m001_initial(db):
|
|||
# =========================================================================
|
||||
# MANUAL PAYMENT REQUESTS TABLE
|
||||
# =========================================================================
|
||||
# User-submitted payment requests to Castle (reviewed by admins)
|
||||
# User-submitted payment requests to Libra (reviewed by admins)
|
||||
|
||||
await db.execute(
|
||||
f"""
|
||||
|
|
@ -362,7 +362,7 @@ async def m003_add_account_is_virtual(db):
|
|||
Add is_virtual field to accounts table for virtual parent accounts.
|
||||
|
||||
Virtual parent accounts:
|
||||
- Exist only in Castle DB (metadata-only, not in Beancount)
|
||||
- Exist only in Libra DB (metadata-only, not in Beancount)
|
||||
- Used solely for permission inheritance
|
||||
- Allow granting permissions on top-level accounts like "Expenses", "Assets"
|
||||
- Are not synced to/from Beancount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue