Skip to content

Commit

Permalink
feat(deployment): implements ui auto top up toggle
Browse files Browse the repository at this point in the history
refs #714
  • Loading branch information
ygrishajev committed Feb 4, 2025
1 parent 5e2b976 commit faf2fe3
Show file tree
Hide file tree
Showing 24 changed files with 1,031 additions and 59 deletions.
1 change: 1 addition & 0 deletions apps/api/drizzle/0009_mysterious_blacklash.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "deployment_settings";
17 changes: 17 additions & 0 deletions apps/api/drizzle/0010_naive_living_tribunal.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS "deployment_settings" (
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL,
"user_id" uuid NOT NULL,
"dseq" varchar NOT NULL,
"auto_top_up_enabled" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
CONSTRAINT "dseq_user_id_idx" UNIQUE("dseq","user_id")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "deployment_settings" ADD CONSTRAINT "deployment_settings_user_id_userSetting_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."userSetting"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "auto_top_up_enabled_id_idx" ON "deployment_settings" USING btree ("auto_top_up_enabled","id");
304 changes: 304 additions & 0 deletions apps/api/drizzle/meta/0009_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
{
"id": "266bc991-0645-4879-b6a9-18006839247c",
"prevId": "54fe3617-4303-4cfb-b09e-62d9f09b5ab5",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.user_wallets": {
"name": "user_wallets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"stripe_customer_id": {
"name": "stripe_customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"deployment_allowance": {
"name": "deployment_allowance",
"type": "numeric(20, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0.00'"
},
"fee_allowance": {
"name": "fee_allowance",
"type": "numeric(20, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0.00'"
},
"trial": {
"name": "trial",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"user_wallets_user_id_userSetting_id_fk": {
"name": "user_wallets_user_id_userSetting_id_fk",
"tableFrom": "user_wallets",
"tableTo": "userSetting",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_wallets_user_id_unique": {
"name": "user_wallets_user_id_unique",
"nullsNotDistinct": false,
"columns": [
"user_id"
]
},
"user_wallets_address_unique": {
"name": "user_wallets_address_unique",
"nullsNotDistinct": false,
"columns": [
"address"
]
}
}
},
"public.checkout_sessions": {
"name": "checkout_sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "uuid_generate_v4()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"session_id": {
"name": "session_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"checkout_sessions_user_id_userSetting_id_fk": {
"name": "checkout_sessions_user_id_userSetting_id_fk",
"tableFrom": "checkout_sessions",
"tableTo": "userSetting",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"checkout_sessions_session_id_unique": {
"name": "checkout_sessions_session_id_unique",
"nullsNotDistinct": false,
"columns": [
"session_id"
]
}
}
},
"public.userSetting": {
"name": "userSetting",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "uuid_generate_v4()"
},
"userId": {
"name": "userId",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"username": {
"name": "username",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"emailVerified": {
"name": "emailVerified",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"stripeCustomerId": {
"name": "stripeCustomerId",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"bio": {
"name": "bio",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscribedToNewsletter": {
"name": "subscribedToNewsletter",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"youtubeUsername": {
"name": "youtubeUsername",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"twitterUsername": {
"name": "twitterUsername",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"githubUsername": {
"name": "githubUsername",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"last_active_at": {
"name": "last_active_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
},
"last_ip": {
"name": "last_ip",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"last_user_agent": {
"name": "last_user_agent",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"last_fingerprint": {
"name": "last_fingerprint",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"userSetting_userId_unique": {
"name": "userSetting_userId_unique",
"nullsNotDistinct": false,
"columns": [
"userId"
]
},
"userSetting_username_unique": {
"name": "userSetting_username_unique",
"nullsNotDistinct": false,
"columns": [
"username"
]
}
}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
Loading

0 comments on commit faf2fe3

Please sign in to comment.