create-efforge 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/dist/addon.js +115 -0
- package/dist/bin.js +13 -0
- package/dist/cli.js +28 -0
- package/dist/commands/add.js +640 -0
- package/dist/commands/create.js +319 -0
- package/dist/commands/list.js +80 -0
- package/dist/diff.js +72 -0
- package/dist/exec.js +33 -0
- package/dist/generate.js +181 -0
- package/dist/manifest.js +14 -0
- package/dist/projectName.js +41 -0
- package/dist/prompts/flow.js +122 -0
- package/dist/prompts/navigable.js +193 -0
- package/dist/routeTree.js +7 -0
- package/dist/rules.js +27 -0
- package/dist/slots.js +116 -0
- package/dist/stack.js +68 -0
- package/dist/transforms/addAlchemyResource.js +71 -0
- package/dist/transforms/addArrayItem.js +31 -0
- package/dist/transforms/addAuthPlugin.js +77 -0
- package/dist/transforms/addDevVar.js +18 -0
- package/dist/transforms/addExport.js +46 -0
- package/dist/transforms/addImport.js +11 -0
- package/dist/transforms/addLayer.js +31 -0
- package/dist/transforms/addServerFnMiddleware.js +62 -0
- package/dist/transforms/addWorkflowSecret.js +43 -0
- package/dist/transforms/addWranglerBinding.js +61 -0
- package/dist/transforms/appendAgentsSection.js +26 -0
- package/dist/transforms/errors.js +7 -0
- package/dist/transforms/index.js +40 -0
- package/dist/transforms/setWranglerValue.js +40 -0
- package/dist/transforms/util.js +219 -0
- package/dist/tree.js +1 -0
- package/dist/versions.js +73 -0
- package/dist/write.js +28 -0
- package/package.json +63 -4
- package/templates/ai/effect-ai-byok/addon.json +619 -0
- package/templates/ai/effect-ai-byok/files/core/llm-crypto.test.ts +52 -0
- package/templates/ai/effect-ai-byok/files/core/llm-crypto.ts +76 -0
- package/templates/ai/effect-ai-byok/files/core/llm-store.ts +21 -0
- package/templates/ai/effect-ai-byok/files/core/llm.ts +32 -0
- package/templates/ai/effect-ai-byok/files/drizzle/d1/20261018161056_llm_credential/migration.sql +9 -0
- package/templates/ai/effect-ai-byok/files/drizzle/d1/20261018161056_llm_credential/snapshot.json +944 -0
- package/templates/ai/effect-ai-byok/files/drizzle/pg/20261018161056_llm_credential/migration.sql +10 -0
- package/templates/ai/effect-ai-byok/files/drizzle/pg/20261018161056_llm_credential/snapshot.json +1232 -0
- package/templates/ai/effect-ai-byok/files/routes/ai.tsx +193 -0
- package/templates/ai/effect-ai-byok/files/schema/d1.ts +16 -0
- package/templates/ai/effect-ai-byok/files/schema/pg.ts +14 -0
- package/templates/ai/effect-ai-byok/files/server/ai-settings.ts +129 -0
- package/templates/ai/effect-ai-byok/files/server/ai.ts +25 -0
- package/templates/ai/effect-ai-byok/files/server/llm-env.ts +48 -0
- package/templates/ai/effect-ai-byok/files/server/llm-orgs.ts +146 -0
- package/templates/ai/effect-ai-byok/files/server/llm-provider.ts +56 -0
- package/templates/ai/effect-ai-byok/files/server/llm-store-drizzle.ts +48 -0
- package/templates/ai/effect-ai-byok/files/server/llm-store-sql-d1.ts +41 -0
- package/templates/ai/effect-ai-byok/files/server/llm-store-sql-pg.ts +41 -0
- package/templates/ai/effect-ai-byok/files/sql/d1.sql +8 -0
- package/templates/ai/effect-ai-byok/files/sql/pg.sql +8 -0
- package/templates/auth/better-auth/addon.json +424 -0
- package/templates/auth/better-auth/files/core/Auth.ts +18 -0
- package/templates/auth/better-auth/files/drizzle/d1/20261018161054_auth/migration.sql +51 -0
- package/templates/auth/better-auth/files/drizzle/d1/20261018161054_auth/snapshot.json +522 -0
- package/templates/auth/better-auth/files/drizzle/pg/20261018161053_auth/migration.sql +51 -0
- package/templates/auth/better-auth/files/drizzle/pg/20261018161053_auth/snapshot.json +680 -0
- package/templates/auth/better-auth/files/lib/auth-client.ts +4 -0
- package/templates/auth/better-auth/files/routes/app.tsx +54 -0
- package/templates/auth/better-auth/files/schema/d1/auth-schema.ts +86 -0
- package/templates/auth/better-auth/files/schema/pg/auth-schema.ts +73 -0
- package/templates/auth/better-auth/files/server/auth-live.ts +47 -0
- package/templates/auth/better-auth/files/server/session.ts +14 -0
- package/templates/auth/better-auth/files/shared/components/auth-card.tsx +32 -0
- package/templates/auth/better-auth/files/shared/components/user-menu.tsx +44 -0
- package/templates/auth/better-auth/files/shared/drizzle/d1/drizzle.config.ts +7 -0
- package/templates/auth/better-auth/files/shared/drizzle/pg/drizzle.config.ts +10 -0
- package/templates/auth/better-auth/files/shared/lib/form.ts +5 -0
- package/templates/auth/better-auth/files/shared/lib/redirect.ts +6 -0
- package/templates/auth/better-auth/files/shared/routes/app/index.tsx +54 -0
- package/templates/auth/better-auth/files/shared/routes/sign-in.tsx +85 -0
- package/templates/auth/better-auth/files/shared/routes/sign-up.tsx +91 -0
- package/templates/auth/better-auth/files/shared/server/auth-route.ts +15 -0
- package/templates/auth/better-auth/files/shared/server/auth.ts +22 -0
- package/templates/auth/better-auth/files/shared/server/db/d1-drizzle.ts +25 -0
- package/templates/auth/better-auth/files/shared/server/db/d1-effect-sql.ts +17 -0
- package/templates/auth/better-auth/files/shared/server/db/pg-drizzle.ts +32 -0
- package/templates/auth/better-auth/files/shared/server/db/pg-effect-sql.ts +29 -0
- package/templates/auth/better-auth/files/shared/server/require-session.ts +20 -0
- package/templates/auth/better-auth/files/sql/d1/0002_auth.sql +13 -0
- package/templates/auth/better-auth/files/sql/pg/0002_auth.sql +13 -0
- package/templates/auth/better-auth-orgs/addon.json +463 -0
- package/templates/auth/better-auth-orgs/files/components/org-switcher.tsx +65 -0
- package/templates/auth/better-auth-orgs/files/core/Auth.ts +20 -0
- package/templates/auth/better-auth-orgs/files/drizzle/d1/20261018161055_auth/migration.sql +88 -0
- package/templates/auth/better-auth-orgs/files/drizzle/d1/20261018161055_auth/snapshot.json +862 -0
- package/templates/auth/better-auth-orgs/files/drizzle/pg/20261018161055_auth/migration.sql +88 -0
- package/templates/auth/better-auth-orgs/files/drizzle/pg/20261018161055_auth/snapshot.json +1127 -0
- package/templates/auth/better-auth-orgs/files/lib/auth-client.ts +5 -0
- package/templates/auth/better-auth-orgs/files/routes/accept-invite.$id.tsx +68 -0
- package/templates/auth/better-auth-orgs/files/routes/app/settings/index.tsx +27 -0
- package/templates/auth/better-auth-orgs/files/routes/app/settings/members.tsx +202 -0
- package/templates/auth/better-auth-orgs/files/routes/app/settings.tsx +30 -0
- package/templates/auth/better-auth-orgs/files/routes/app.tsx +58 -0
- package/templates/auth/better-auth-orgs/files/routes/onboarding.tsx +66 -0
- package/templates/auth/better-auth-orgs/files/schema/d1/auth-schema.ts +139 -0
- package/templates/auth/better-auth-orgs/files/schema/pg/auth-schema.ts +124 -0
- package/templates/auth/better-auth-orgs/files/server/auth-live.ts +52 -0
- package/templates/auth/better-auth-orgs/files/server/session.ts +44 -0
- package/templates/auth/better-auth-orgs/files/sql/d1/0002_auth.sql +27 -0
- package/templates/auth/better-auth-orgs/files/sql/pg/0002_auth.sql +27 -0
- package/templates/base/addon.json +216 -0
- package/templates/base/files/AGENTS.md +82 -0
- package/templates/base/files/CLAUDE.md +1 -0
- package/templates/base/files/README.md +32 -0
- package/templates/base/files/core/package.json +13 -0
- package/templates/base/files/core/src/index.ts +2 -0
- package/templates/base/files/core/test/core.test.ts +4 -0
- package/templates/base/files/core/tsconfig.json +6 -0
- package/templates/base/files/gitignore +11 -0
- package/templates/base/files/pnpm-workspace.yaml +11 -0
- package/templates/base/files/root/lint/effect-tests.js +45 -0
- package/templates/base/files/root/package.json +16 -0
- package/templates/base/files/root/tsconfig.base.json +19 -0
- package/templates/base/files/root/turbo.json +9 -0
- package/templates/base/files/root/vite.config.ts +86 -0
- package/templates/base/files/web/components.json +21 -0
- package/templates/base/files/web/package.json +17 -0
- package/templates/base/files/web/src/components/theme-provider.tsx +57 -0
- package/templates/base/files/web/src/components/theme-toggle.tsx +34 -0
- package/templates/base/files/web/src/components/ui/avatar.tsx +93 -0
- package/templates/base/files/web/src/components/ui/button.tsx +61 -0
- package/templates/base/files/web/src/components/ui/card.tsx +74 -0
- package/templates/base/files/web/src/components/ui/dialog.tsx +141 -0
- package/templates/base/files/web/src/components/ui/dropdown-menu.tsx +225 -0
- package/templates/base/files/web/src/components/ui/input.tsx +20 -0
- package/templates/base/files/web/src/components/ui/label.tsx +18 -0
- package/templates/base/files/web/src/components/ui/sonner.tsx +45 -0
- package/templates/base/files/web/src/components/widgets.tsx +4 -0
- package/templates/base/files/web/src/lib/utils.ts +6 -0
- package/templates/base/files/web/src/router.tsx +12 -0
- package/templates/base/files/web/src/routes/__root.tsx +42 -0
- package/templates/base/files/web/src/routes/app/index.tsx +27 -0
- package/templates/base/files/web/src/routes/app/settings.tsx +29 -0
- package/templates/base/files/web/src/routes/app.tsx +47 -0
- package/templates/base/files/web/src/routes/index.tsx +51 -0
- package/templates/base/files/web/src/server/greeting.ts +12 -0
- package/templates/base/files/web/src/server/layers.ts +10 -0
- package/templates/base/files/web/src/server/runtime.ts +5 -0
- package/templates/base/files/web/src/styles.css +81 -0
- package/templates/base/files/web/tsconfig.json +11 -0
- package/templates/base/files/web/vite.config.ts +9 -0
- package/templates/database/d1/addon.json +118 -0
- package/templates/database/d1/files/package.json +12 -0
- package/templates/database/d1/files/tsconfig.json +5 -0
- package/templates/database/postgres/addon.json +142 -0
- package/templates/database/postgres/files/docker-compose.yml +21 -0
- package/templates/database/postgres/files/package.json +12 -0
- package/templates/database/postgres/files/runtime.ts +12 -0
- package/templates/database/postgres/files/tsconfig.json +5 -0
- package/templates/extras/browser/addon.json +173 -0
- package/templates/extras/browser/files/BrowserContainer.ts +14 -0
- package/templates/extras/browser/files/app/Dockerfile +15 -0
- package/templates/extras/browser/files/app/dockerignore +1 -0
- package/templates/extras/browser/files/app/package-lock +605 -0
- package/templates/extras/browser/files/app/package.json +9 -0
- package/templates/extras/browser/files/app/src/server.ts +78 -0
- package/templates/extras/browser/files/app/src/url-policy.ts +115 -0
- package/templates/extras/browser/files/app/tsconfig.json +6 -0
- package/templates/extras/browser/files/browser.ts +34 -0
- package/templates/extras/browser/files/core-browser.ts +21 -0
- package/templates/extras/browser/files/run-browser.ts +25 -0
- package/templates/extras/email/addon.json +182 -0
- package/templates/extras/email/files/core-mailer.ts +28 -0
- package/templates/extras/email/files/invitation-email.ts +38 -0
- package/templates/extras/email/files/mailer.ts +58 -0
- package/templates/extras/realtime/addon.json +135 -0
- package/templates/extras/realtime/files/Room.ts +46 -0
- package/templates/extras/realtime/files/core-realtime.ts +19 -0
- package/templates/extras/realtime/files/realtime-demo.tsx +40 -0
- package/templates/extras/realtime/files/realtime-limits.test.ts +32 -0
- package/templates/extras/realtime/files/realtime-limits.ts +35 -0
- package/templates/extras/realtime/files/realtime-route.ts +39 -0
- package/templates/extras/realtime/files/realtime.ts +39 -0
- package/templates/extras/realtime/files/use-room.ts +67 -0
- package/templates/extras/storage/addon.json +132 -0
- package/templates/extras/storage/files/core-storage.ts +64 -0
- package/templates/extras/storage/files/storage-route.ts +50 -0
- package/templates/extras/storage/files/storage-security.test.ts +71 -0
- package/templates/extras/storage/files/storage-security.ts +92 -0
- package/templates/extras/storage/files/storage.ts +84 -0
- package/templates/extras/workflows/addon.json +95 -0
- package/templates/extras/workflows/files/Example.ts +42 -0
- package/templates/extras/workflows/files/core-jobs.ts +45 -0
- package/templates/extras/workflows/files/example-job.ts +36 -0
- package/templates/extras/workflows/files/jobs.ts +34 -0
- package/templates/infra/alchemy/addon.json +37 -0
- package/templates/infra/alchemy/files/README.md +27 -0
- package/templates/infra/alchemy/files/alchemy.run.ts +36 -0
- package/templates/infra/alchemy/files/github/deploy.yml +63 -0
- package/templates/infra/alchemy/files/tsconfig.json +5 -0
- package/templates/infra/alchemy/files/vite.config.ts +30 -0
- package/templates/orm/drizzle/addon.json +188 -0
- package/templates/orm/drizzle/files/d1/Database.ts +7 -0
- package/templates/orm/drizzle/files/d1/drizzle/20261018154417_init/migration.sql +10 -0
- package/templates/orm/drizzle/files/d1/drizzle/20261018154417_init/snapshot.json +60 -0
- package/templates/orm/drizzle/files/d1/drizzle.config.ts +7 -0
- package/templates/orm/drizzle/files/d1/layer.ts +13 -0
- package/templates/orm/drizzle/files/d1/migrate.ts +37 -0
- package/templates/orm/drizzle/files/d1/schema.ts +15 -0
- package/templates/orm/drizzle/files/pg/Database.ts +7 -0
- package/templates/orm/drizzle/files/pg/drizzle/20261018154416_init/migration.sql +10 -0
- package/templates/orm/drizzle/files/pg/drizzle/20261018154416_init/snapshot.json +75 -0
- package/templates/orm/drizzle/files/pg/drizzle.config.ts +10 -0
- package/templates/orm/drizzle/files/pg/layer.ts +16 -0
- package/templates/orm/drizzle/files/pg/migrate.ts +24 -0
- package/templates/orm/drizzle/files/pg/schema.ts +11 -0
- package/templates/orm/drizzle/files/shared/index.ts +2 -0
- package/templates/orm/drizzle/files/shared/notes.ts +15 -0
- package/templates/orm/drizzle/files/shared/page.tsx +50 -0
- package/templates/orm/effect-sql/addon.json +124 -0
- package/templates/orm/effect-sql/files/d1/layer.ts +13 -0
- package/templates/orm/effect-sql/files/d1/migrate.ts +20 -0
- package/templates/orm/effect-sql/files/d1/schema.ts +7 -0
- package/templates/orm/effect-sql/files/d1-sql/0001_init.sql +10 -0
- package/templates/orm/effect-sql/files/pg/layer.ts +16 -0
- package/templates/orm/effect-sql/files/pg/migrate.ts +66 -0
- package/templates/orm/effect-sql/files/pg/schema.ts +7 -0
- package/templates/orm/effect-sql/files/pg-sql/0001_init.sql +10 -0
- package/templates/orm/effect-sql/files/shared/Database.ts +7 -0
- package/templates/orm/effect-sql/files/shared/index.ts +2 -0
- package/templates/orm/effect-sql/files/shared/notes.ts +18 -0
- package/templates/orm/effect-sql/files/shared/page.tsx +50 -0
- package/templates/runtime/cloudflare/addon.json +52 -0
- package/templates/runtime/cloudflare/files/cloudflare.ts +10 -0
- package/templates/runtime/cloudflare/files/routes.ts +5 -0
- package/templates/runtime/cloudflare/files/server.ts +22 -0
- package/templates/runtime/cloudflare/files/tsconfig.json +12 -0
- package/templates/runtime/cloudflare/files/vite.config.ts +20 -0
- package/templates/runtime/cloudflare/files/wrangler.jsonc +8 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Link, useRouter } from "@tanstack/react-router"
|
|
2
|
+
import { Check, ChevronsUpDown, Plus } from "lucide-react"
|
|
3
|
+
import { Button } from "@/components/ui/button"
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuLabel,
|
|
9
|
+
DropdownMenuSeparator,
|
|
10
|
+
DropdownMenuTrigger,
|
|
11
|
+
} from "@/components/ui/dropdown-menu"
|
|
12
|
+
import { authClient } from "@/lib/auth-client"
|
|
13
|
+
|
|
14
|
+
interface Organization {
|
|
15
|
+
readonly id: string
|
|
16
|
+
readonly name: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Lists the user's organizations in the sidebar; picking one makes it the active organization. */
|
|
20
|
+
export function OrgSwitcher({
|
|
21
|
+
organizations,
|
|
22
|
+
activeId,
|
|
23
|
+
}: {
|
|
24
|
+
organizations: ReadonlyArray<Organization>
|
|
25
|
+
activeId: string | null
|
|
26
|
+
}) {
|
|
27
|
+
const router = useRouter()
|
|
28
|
+
const active = organizations.find((org) => org.id === activeId)
|
|
29
|
+
|
|
30
|
+
async function select(organizationId: string) {
|
|
31
|
+
await authClient.organization.setActive({ organizationId })
|
|
32
|
+
await router.invalidate()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<DropdownMenu>
|
|
37
|
+
<DropdownMenuTrigger asChild>
|
|
38
|
+
<Button
|
|
39
|
+
variant="outline"
|
|
40
|
+
className="w-full justify-between"
|
|
41
|
+
aria-label="Switch organization"
|
|
42
|
+
>
|
|
43
|
+
<span className="truncate">{active?.name ?? "Select organization"}</span>
|
|
44
|
+
<ChevronsUpDown className="size-4 opacity-50" />
|
|
45
|
+
</Button>
|
|
46
|
+
</DropdownMenuTrigger>
|
|
47
|
+
<DropdownMenuContent align="start" className="w-56">
|
|
48
|
+
<DropdownMenuLabel>Organizations</DropdownMenuLabel>
|
|
49
|
+
{organizations.map((org) => (
|
|
50
|
+
<DropdownMenuItem key={org.id} onSelect={() => void select(org.id)}>
|
|
51
|
+
<span className="flex-1 truncate">{org.name}</span>
|
|
52
|
+
{org.id === activeId ? <Check className="size-4" /> : null}
|
|
53
|
+
</DropdownMenuItem>
|
|
54
|
+
))}
|
|
55
|
+
<DropdownMenuSeparator />
|
|
56
|
+
<DropdownMenuItem asChild>
|
|
57
|
+
<Link to="/onboarding">
|
|
58
|
+
<Plus className="size-4" />
|
|
59
|
+
Create organization
|
|
60
|
+
</Link>
|
|
61
|
+
</DropdownMenuItem>
|
|
62
|
+
</DropdownMenuContent>
|
|
63
|
+
</DropdownMenu>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, Data, type Effect } from "effect"
|
|
2
|
+
|
|
3
|
+
/** The current request has no signed-in user. */
|
|
4
|
+
export class Unauthorized extends Data.TaggedError("Unauthorized")<{
|
|
5
|
+
readonly message: string
|
|
6
|
+
}> {}
|
|
7
|
+
|
|
8
|
+
export interface Session {
|
|
9
|
+
readonly userId: string
|
|
10
|
+
readonly email: string
|
|
11
|
+
readonly name: string
|
|
12
|
+
/** The organization the user is working in, or null before they belong to one. */
|
|
13
|
+
readonly activeOrganizationId: string | null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Who is making the current request. Implemented by Better Auth in apps/web/src/server/auth-live.ts. */
|
|
17
|
+
export class Auth extends Context.Service<
|
|
18
|
+
Auth,
|
|
19
|
+
{ readonly currentSession: Effect.Effect<Session, Unauthorized> }
|
|
20
|
+
>()("@repo/core/Auth") {}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
CREATE TABLE `account` (
|
|
2
|
+
`id` text PRIMARY KEY,
|
|
3
|
+
`account_id` text NOT NULL,
|
|
4
|
+
`provider_id` text NOT NULL,
|
|
5
|
+
`user_id` text NOT NULL,
|
|
6
|
+
`access_token` text,
|
|
7
|
+
`refresh_token` text,
|
|
8
|
+
`id_token` text,
|
|
9
|
+
`access_token_expires_at` integer,
|
|
10
|
+
`refresh_token_expires_at` integer,
|
|
11
|
+
`scope` text,
|
|
12
|
+
`password` text,
|
|
13
|
+
`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
|
|
14
|
+
`updated_at` integer NOT NULL,
|
|
15
|
+
CONSTRAINT `fk_account_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE TABLE `invitation` (
|
|
19
|
+
`id` text PRIMARY KEY,
|
|
20
|
+
`organization_id` text NOT NULL,
|
|
21
|
+
`email` text NOT NULL,
|
|
22
|
+
`role` text,
|
|
23
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
24
|
+
`expires_at` integer NOT NULL,
|
|
25
|
+
`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
|
|
26
|
+
`inviter_id` text NOT NULL,
|
|
27
|
+
CONSTRAINT `fk_invitation_organization_id_organization_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON DELETE CASCADE,
|
|
28
|
+
CONSTRAINT `fk_invitation_inviter_id_user_id_fk` FOREIGN KEY (`inviter_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
|
29
|
+
);
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
CREATE TABLE `member` (
|
|
32
|
+
`id` text PRIMARY KEY,
|
|
33
|
+
`organization_id` text NOT NULL,
|
|
34
|
+
`user_id` text NOT NULL,
|
|
35
|
+
`role` text DEFAULT 'member' NOT NULL,
|
|
36
|
+
`created_at` integer NOT NULL,
|
|
37
|
+
CONSTRAINT `fk_member_organization_id_organization_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON DELETE CASCADE,
|
|
38
|
+
CONSTRAINT `fk_member_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
|
39
|
+
);
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `organization` (
|
|
42
|
+
`id` text PRIMARY KEY,
|
|
43
|
+
`name` text NOT NULL,
|
|
44
|
+
`slug` text NOT NULL UNIQUE,
|
|
45
|
+
`logo` text,
|
|
46
|
+
`created_at` integer NOT NULL,
|
|
47
|
+
`metadata` text
|
|
48
|
+
);
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
CREATE TABLE `session` (
|
|
51
|
+
`id` text PRIMARY KEY,
|
|
52
|
+
`expires_at` integer NOT NULL,
|
|
53
|
+
`token` text NOT NULL UNIQUE,
|
|
54
|
+
`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
|
|
55
|
+
`updated_at` integer NOT NULL,
|
|
56
|
+
`ip_address` text,
|
|
57
|
+
`user_agent` text,
|
|
58
|
+
`user_id` text NOT NULL,
|
|
59
|
+
`active_organization_id` text,
|
|
60
|
+
CONSTRAINT `fk_session_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
|
61
|
+
);
|
|
62
|
+
--> statement-breakpoint
|
|
63
|
+
CREATE TABLE `user` (
|
|
64
|
+
`id` text PRIMARY KEY,
|
|
65
|
+
`name` text NOT NULL,
|
|
66
|
+
`email` text NOT NULL UNIQUE,
|
|
67
|
+
`email_verified` integer DEFAULT false NOT NULL,
|
|
68
|
+
`image` text,
|
|
69
|
+
`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
|
|
70
|
+
`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL
|
|
71
|
+
);
|
|
72
|
+
--> statement-breakpoint
|
|
73
|
+
CREATE TABLE `verification` (
|
|
74
|
+
`id` text PRIMARY KEY,
|
|
75
|
+
`identifier` text NOT NULL,
|
|
76
|
+
`value` text NOT NULL,
|
|
77
|
+
`expires_at` integer NOT NULL,
|
|
78
|
+
`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
|
|
79
|
+
`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL
|
|
80
|
+
);
|
|
81
|
+
--> statement-breakpoint
|
|
82
|
+
CREATE INDEX `account_userId_idx` ON `account` (`user_id`);--> statement-breakpoint
|
|
83
|
+
CREATE INDEX `invitation_organizationId_idx` ON `invitation` (`organization_id`);--> statement-breakpoint
|
|
84
|
+
CREATE INDEX `invitation_email_idx` ON `invitation` (`email`);--> statement-breakpoint
|
|
85
|
+
CREATE INDEX `member_organizationId_idx` ON `member` (`organization_id`);--> statement-breakpoint
|
|
86
|
+
CREATE INDEX `member_userId_idx` ON `member` (`user_id`);--> statement-breakpoint
|
|
87
|
+
CREATE INDEX `session_userId_idx` ON `session` (`user_id`);--> statement-breakpoint
|
|
88
|
+
CREATE INDEX `verification_identifier_idx` ON `verification` (`identifier`);
|