Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
thilobillerbeck committed Jan 27, 2025
2 parents 6ab20a4 + 4cf4344 commit d0a9c3f
Show file tree
Hide file tree
Showing 31 changed files with 2,103 additions and 857 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN pnpm install --prod --frozen-lockfile
FROM base AS build
RUN pnpm install --frozen-lockfile
RUN pnpm run tailwind:build
RUN pnpm run generate
RUN pnpm run build

FROM base
Expand Down
32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@ Skymoth is an open source service which allows you to share the content you post
- Reposting text (and handle threads)
- Reposting (multiple) images with alt descriptions

## Things to do
## Migrating from <= v0.3.2 to > v0.4.0

- More media reposting options
- Taking Bluesky posts over to Mastodon (this is quite rough thanks to rate limits)
- A better frontend (I know, I usually do UI/UX myself but this was not the priority here)
- Per instance polling intervals
With v0.4.0 Drizzle will be the new ORM of choice. Thus Prisma and its migration tracking table
will be dropped accordingly. To make the upgrading process go smoothly, Skymoth checks if all migrations
from Prisma have been applied before migrating. If you have an instance running on a version below v0.3.2
upgrade to v0.3.2 first before upgrading to v0.4.0 and above.

Additionally, Drizzle will execute its migrations automatically on app startup, so there is no need to run `pnpm migrate`
after an update.

## Development

For development using [Cachix Devenv](https://devenv.sh/) is strongly advised.
After setting up, you can just enter this projects shell.

Before starting the project you need to copy the `.env.local` over to `.env`:

```bash
cp .env.local .env
```

and modify it to to your needs. Then install all javascript dependencies by executing
After setting up, you can just enter this projects shell just run:

```bash
pnpm install
Expand All @@ -42,15 +37,6 @@ Don't worry, if set up correctly the development shell you are in should contain
devenv up
```

after starting you may need to run

```bash
pnpm migrate
pnpm generate
```

to apply all migrations.

## FAQ

### Is this free to use?
Expand Down
13 changes: 13 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'postgresql',
out: './drizzle',
schema: './drizzle/schema.ts',
dbCredentials: {
url: process.env.POSTGRES_URL!,
},
// Print all statements
verbose: true,
// Always ask for confirmation
strict: true,
});
46 changes: 46 additions & 0 deletions drizzle/0000_shallow_puck.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
CREATE TYPE "public"."RelayCriteria" AS ENUM('all', 'favedBySelf', 'containsMarker', 'notContainsMarker');--> statement-breakpoint
CREATE TYPE "public"."StatusVisibility" AS ENUM('public', 'unlisted', 'private', 'direct');--> statement-breakpoint
CREATE TABLE "MastodonInstance" (
"id" text PRIMARY KEY NOT NULL,
"urlEncoded" text NOT NULL,
"url" text NOT NULL,
"applicationId" text NOT NULL,
"applicationSecret" text NOT NULL,
"createdAt" timestamp(3) DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updatedAt" timestamp(3) NOT NULL
);
--> statement-breakpoint
CREATE TABLE "Repost" (
"id" text PRIMARY KEY NOT NULL,
"createdAt" timestamp(3) DEFAULT CURRENT_TIMESTAMP NOT NULL,
"userId" text NOT NULL,
"tootId" text NOT NULL,
"bsRootUri" text NOT NULL,
"bsRootCid" text NOT NULL,
"bsParentUri" text NOT NULL,
"bsParentCid" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE "User" (
"id" text PRIMARY KEY NOT NULL,
"createdAt" timestamp(3) DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updatedAt" timestamp(3) NOT NULL,
"lastTootTime" timestamp(3) DEFAULT CURRENT_TIMESTAMP NOT NULL,
"name" text NOT NULL,
"mastodonUid" text NOT NULL,
"mastodonToken" text NOT NULL,
"blueskyToken" text,
"blueskyHandle" text,
"blueskySession" jsonb,
"blueskySessionEvent" text,
"mastodonInstanceId" text NOT NULL,
"blueskyPDS" text DEFAULT 'https://bsky.social',
"relayCriteria" "RelayCriteria" DEFAULT 'all' NOT NULL,
"relayMarker" text DEFAULT '' NOT NULL,
"relayVisibility" "StatusVisibility"[] DEFAULT '{"public"}'
);
--> statement-breakpoint
ALTER TABLE "Repost" ADD CONSTRAINT "Repost_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "User" ADD CONSTRAINT "User_mastodonInstanceId_fkey" FOREIGN KEY ("mastodonInstanceId") REFERENCES "public"."MastodonInstance"("id") ON DELETE restrict ON UPDATE cascade;--> statement-breakpoint
CREATE UNIQUE INDEX "MastodonInstance_urlEncoded_key" ON "MastodonInstance" USING btree ("urlEncoded" text_ops);--> statement-breakpoint
CREATE UNIQUE INDEX "MastodonInstance_url_key" ON "MastodonInstance" USING btree ("url" text_ops);
Loading

0 comments on commit d0a9c3f

Please sign in to comment.