Move drizzle/, dist/, and coverage/ into apps/server/ so all server-specific artifacts live alongside the source they belong to. - git mv drizzle/ → apps/server/drizzle/ - drizzle.config.ts: out → ./apps/server/drizzle - tsconfig.json: outDir → ./apps/server/dist, exclude drizzle dir - package.json: main/bin/clean point to apps/server/dist/ - vitest.config.ts: reportsDirectory → ./apps/server/coverage - .gitignore: add coverage/ entry - ensure-schema.ts: update getMigrationsPath() for new layout - docs/database-migrations.md: update drizzle/ references
26 lines
1.0 KiB
SQL
26 lines
1.0 KiB
SQL
-- Add change_sets and change_set_entries tables
|
|
CREATE TABLE `change_sets` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`agent_id` text REFERENCES `agents`(`id`) ON DELETE SET NULL,
|
|
`agent_name` text NOT NULL,
|
|
`initiative_id` text NOT NULL REFERENCES `initiatives`(`id`) ON DELETE CASCADE,
|
|
`mode` text NOT NULL,
|
|
`summary` text,
|
|
`status` text NOT NULL DEFAULT 'applied',
|
|
`reverted_at` integer,
|
|
`created_at` integer NOT NULL
|
|
);--> statement-breakpoint
|
|
CREATE TABLE `change_set_entries` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`change_set_id` text NOT NULL REFERENCES `change_sets`(`id`) ON DELETE CASCADE,
|
|
`entity_type` text NOT NULL,
|
|
`entity_id` text NOT NULL,
|
|
`action` text NOT NULL,
|
|
`previous_state` text,
|
|
`new_state` text,
|
|
`sort_order` integer NOT NULL DEFAULT 0,
|
|
`created_at` integer NOT NULL
|
|
);--> statement-breakpoint
|
|
CREATE INDEX `change_sets_initiative_id_idx` ON `change_sets`(`initiative_id`);--> statement-breakpoint
|
|
CREATE INDEX `change_set_entries_change_set_id_idx` ON `change_set_entries`(`change_set_id`);
|