-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
17,962 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CREATE TYPE "public"."theme_pref" AS ENUM('system', 'dark', 'light');--> statement-breakpoint | ||
CREATE TABLE "user_prefs" ( | ||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
"created_at" timestamp DEFAULT now(), | ||
"updated_at" timestamp DEFAULT now(), | ||
"user" bigint NOT NULL, | ||
"country" varchar(2) NOT NULL, | ||
"theme" "theme_pref" DEFAULT 'light', | ||
"currency" varchar(3) NOT NULL | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "user_prefs" ADD CONSTRAINT "user_prefs_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE "account_transactions" ADD COLUMN "notes" text;--> statement-breakpoint | ||
ALTER TABLE "wallet_transactions" ADD COLUMN "notes" text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "user_prefs" ADD COLUMN "language" varchar(2) NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TYPE "public"."account_connection_providers" AS ENUM('telegram');--> statement-breakpoint | ||
CREATE TABLE "account_connections" ( | ||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
"created_at" timestamp DEFAULT now(), | ||
"updated_at" timestamp DEFAULT now(), | ||
"user" bigint NOT NULL, | ||
"provider" "account_connection_providers" NOT NULL, | ||
"params" jsonb NOT NULL, | ||
"is_valid" boolean DEFAULT true | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "account_transactions" RENAME COLUMN "payment_method_extras" TO "params";--> statement-breakpoint | ||
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TYPE "public"."account_connection_status" AS ENUM('active', 'inactive', 'reconnect_required');--> statement-breakpoint | ||
ALTER TABLE "account_transactions" RENAME TO "payment_transactions";--> statement-breakpoint | ||
ALTER TABLE "wallet_transactions" DROP CONSTRAINT "wallet_transactions_account_transaction_account_transactions_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "account_connections" ADD COLUMN "status" "account_connection_status" DEFAULT 'active' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "wallet_transactions" ADD CONSTRAINT "wallet_transactions_account_transaction_payment_transactions_id_fk" FOREIGN KEY ("account_transaction") REFERENCES "public"."payment_transactions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
ALTER TABLE "account_connections" DROP COLUMN "is_valid"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALTER TABLE "account_connections" DROP CONSTRAINT "account_connections_user_users_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CREATE TABLE "verification_codes" ( | ||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
"window" interval NOT NULL, | ||
"code" varchar(6) NOT NULL, | ||
"confirmed_at" timestamp, | ||
"data" jsonb, | ||
CONSTRAINT "verification_codes_code_unique" UNIQUE("code") | ||
); | ||
--> statement-breakpoint | ||
CREATE VIEW "public"."vw_verification_codes" AS (select "code", "created_at", | ||
("created_at" + "window")::TIMESTAMP | ||
as "expires_at", | ||
(CASE | ||
WHEN "confirmed_at" IS NOT NULL THEN true | ||
ELSE NOW() > ("created_at" + "window") | ||
END)::BOOlEAN | ||
as "is_expired", "data" from "verification_codes"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DROP VIEW "public"."vw_verification_codes";--> statement-breakpoint | ||
ALTER TABLE "verification_codes" DROP CONSTRAINT "verification_codes_code_unique";--> statement-breakpoint | ||
ALTER TABLE "verification_codes" ADD COLUMN "hash" varchar(32) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "verification_codes" DROP COLUMN "code";--> statement-breakpoint | ||
ALTER TABLE "verification_codes" ADD CONSTRAINT "verification_codes_hash_unique" UNIQUE("hash");--> statement-breakpoint | ||
CREATE VIEW "public"."vw_verification_codes" AS (select "hash", "created_at", | ||
("created_at" + "window")::TIMESTAMP | ||
as "expires_at", | ||
(CASE | ||
WHEN "confirmed_at" IS NOT NULL THEN true | ||
ELSE NOW() > ("created_at" + "window") | ||
END)::BOOlEAN | ||
as "is_expired", "data" from "verification_codes"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ALTER TABLE "account_connections" DROP CONSTRAINT "account_connections_user_users_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET DEFAULT 'system';--> statement-breakpoint | ||
ALTER TABLE "account_connections" ADD COLUMN "provider_id" varchar(255) NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET DEFAULT 'light'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TYPE "public"."payment_methods" RENAME TO "payment_methods_types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TYPE "public"."payment_method_status" AS ENUM('active', 'inactive', 're-connection required');--> statement-breakpoint | ||
ALTER TYPE "public"."payment_methods_types" RENAME TO "payment_method_provider";--> statement-breakpoint | ||
CREATE TABLE "payment_methods" ( | ||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
"provider" "payment_method_provider" NOT NULL, | ||
"params" jsonb NOT NULL, | ||
"status" "payment_method_status" DEFAULT 'active' NOT NULL, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
"updated_at" timestamp DEFAULT now() NOT NULL, | ||
"owner" bigint NOT NULL | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "payment_methods" ADD CONSTRAINT "payment_methods_owner_users_id_fk" FOREIGN KEY ("owner") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE UNIQUE INDEX "payment_methods_provider_owner_index" ON "payment_methods" USING btree ("provider","owner"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ALTER TABLE "campaign_publications" DROP CONSTRAINT "campaign_publications_campaign_campaigns_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "campaigns" DROP CONSTRAINT "campaigns_created_by_users_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "payment_methods" DROP CONSTRAINT "payment_methods_owner_users_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "wallets" DROP CONSTRAINT "wallets_owned_by_users_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "campaign_publications" ADD CONSTRAINT "campaign_publications_campaign_campaigns_id_fk" FOREIGN KEY ("campaign") REFERENCES "public"."campaigns"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
ALTER TABLE "campaigns" ADD CONSTRAINT "campaigns_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
ALTER TABLE "payment_methods" ADD CONSTRAINT "payment_methods_owner_users_id_fk" FOREIGN KEY ("owner") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
ALTER TABLE "wallets" ADD CONSTRAINT "wallets_owned_by_users_id_fk" FOREIGN KEY ("owned_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; |
Oops, something went wrong.