mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 07:41:24 +02:00
refactor(db): consolidate ~20+ databases into 2 (mana_platform + mana_sync)
Mirrors the frontend unification (single IndexedDB) on the backend. All services now use pgSchema() for isolation within one shared database, enabling cross-schema JOINs, simplified ops, and zero DB setup for new apps. - Migrate 7 services from pgTable() to pgSchema(): mana-user (usr), mana-media (media), todo, traces, presi, uload, cards - Update all DATABASE_URLs in .env.development, docker-compose, configs - Rewrite init-db scripts for 2 databases + 12 schemas - Rewrite setup-databases.sh for consolidated architecture - Update shared-drizzle-config default to mana_platform - Update CLAUDE.md with new database architecture docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b1a5c95f1d
commit
3ea28b9065
44 changed files with 311 additions and 346 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
pgTable,
|
||||
pgSchema,
|
||||
uuid,
|
||||
text,
|
||||
boolean,
|
||||
|
|
@ -10,10 +10,12 @@ import {
|
|||
} from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
|
||||
export const uloadSchema = pgSchema('uload');
|
||||
|
||||
// ============================================
|
||||
// Users Table
|
||||
// ============================================
|
||||
export const users = pgTable(
|
||||
export const users = uloadSchema.table(
|
||||
'users',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
|
@ -48,7 +50,7 @@ export const users = pgTable(
|
|||
// ============================================
|
||||
// Accounts Table
|
||||
// ============================================
|
||||
export const accounts = pgTable(
|
||||
export const accounts = uloadSchema.table(
|
||||
'accounts',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
|
@ -70,7 +72,7 @@ export const accounts = pgTable(
|
|||
// ============================================
|
||||
// Workspaces Table
|
||||
// ============================================
|
||||
export const workspaces = pgTable(
|
||||
export const workspaces = uloadSchema.table(
|
||||
'workspaces',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
|
@ -92,7 +94,7 @@ export const workspaces = pgTable(
|
|||
// ============================================
|
||||
// Links Table
|
||||
// ============================================
|
||||
export const links = pgTable(
|
||||
export const links = uloadSchema.table(
|
||||
'links',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
|
@ -129,7 +131,7 @@ export const links = pgTable(
|
|||
// ============================================
|
||||
// Clicks Table
|
||||
// ============================================
|
||||
export const clicks = pgTable(
|
||||
export const clicks = uloadSchema.table(
|
||||
'clicks',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue