Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"semi": true,
"arrowParens": "avoid",
"singleQuote": true,
"printWidth": 80,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "es5",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
11 changes: 11 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'drizzle-kit';
import { drizzleConfig } from './src/services/database/drizzle/drizzle.config';

export default defineConfig({
out: './drizzle',
schema: './src/services/database/drizzle/schema',
dialect: 'postgresql',
dbCredentials: {
url: drizzleConfig.DATABASE_CONNECTION_URL,
},
});
42 changes: 42 additions & 0 deletions drizzle/0000_dry_pete_wisdom.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
CREATE TABLE "artists" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"twitter_user_id" text NOT NULL,
"username" varchar(255) NOT NULL,
"name" varchar(255),
"tweets_count" integer NOT NULL,
"followers_count" integer NOT NULL,
"weekly_tweets_trend" real DEFAULT 0 NOT NULL,
"weekly_followers_trend" real DEFAULT 0 NOT NULL,
"images" jsonb NOT NULL,
"tags" text[] NOT NULL,
"url" text NOT NULL,
"country" text,
"website" text,
"bio" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "artists_twitter_user_id_unique" UNIQUE("twitter_user_id")
);
--> statement-breakpoint
CREATE TABLE "artistsSuggestions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"username" varchar(255) NOT NULL,
"avatar_url" text NOT NULL,
"country" text,
"tags" text[] NOT NULL,
"status" varchar(255) DEFAULT 'requested' NOT NULL,
"requested_from" text DEFAULT 'suggestions' NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "artistsTrends" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"artist_id" text NOT NULL,
"tweets_count" integer NOT NULL,
"followers_count" integer NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "artistsTrends" ADD CONSTRAINT "artistsTrends_artist_id_artists_twitter_user_id_fk" FOREIGN KEY ("artist_id") REFERENCES "public"."artists"("twitter_user_id") ON DELETE no action ON UPDATE no action;
2 changes: 2 additions & 0 deletions drizzle/0001_spicy_ben_parker.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "artists" ALTER COLUMN "tags" SET DEFAULT '{"pixelart"}';--> statement-breakpoint
ALTER TABLE "artistsSuggestions" ALTER COLUMN "tags" SET DEFAULT '{"pixelart"}';
279 changes: 279 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
{
"id": "ad5fac44-07bc-4611-b5bb-1f9cd6f3a954",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.artists": {
"name": "artists",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"twitter_user_id": {
"name": "twitter_user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"username": {
"name": "username",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"tweets_count": {
"name": "tweets_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"followers_count": {
"name": "followers_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"weekly_tweets_trend": {
"name": "weekly_tweets_trend",
"type": "real",
"primaryKey": false,
"notNull": true,
"default": 0
},
"weekly_followers_trend": {
"name": "weekly_followers_trend",
"type": "real",
"primaryKey": false,
"notNull": true,
"default": 0
},
"images": {
"name": "images",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": true
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"country": {
"name": "country",
"type": "text",
"primaryKey": false,
"notNull": false
},
"website": {
"name": "website",
"type": "text",
"primaryKey": false,
"notNull": false
},
"bio": {
"name": "bio",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"joined_at": {
"name": "joined_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"artists_twitter_user_id_unique": {
"name": "artists_twitter_user_id_unique",
"nullsNotDistinct": false,
"columns": [
"twitter_user_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.artistsSuggestions": {
"name": "artistsSuggestions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"username": {
"name": "username",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"avatar_url": {
"name": "avatar_url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"country": {
"name": "country",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"default": "'requested'"
},
"requested_from": {
"name": "requested_from",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'suggestions'"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.artistsTrends": {
"name": "artistsTrends",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"artist_id": {
"name": "artist_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"tweets_count": {
"name": "tweets_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"followers_count": {
"name": "followers_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"artistsTrends_artist_id_artists_twitter_user_id_fk": {
"name": "artistsTrends_artist_id_artists_twitter_user_id_fk",
"tableFrom": "artistsTrends",
"tableTo": "artists",
"columnsFrom": [
"artist_id"
],
"columnsTo": [
"twitter_user_id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
Loading