Skip to content

Commit

Permalink
feat(indexer): use prisma for migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboesquivel committed Feb 7, 2024
1 parent 5154aac commit c6f852c
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 394 deletions.
4 changes: 2 additions & 2 deletions apps/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"rimraf": "^5.0.5",
"tsconfig": "workspace:*",
"typescript": "^5.3.3",
"@prisma/client": "^5.9.1",
"@prisma/client": "latest",
"prisma": "^5.9.1"
},
"dependencies": {
"smartsale-contracts": "workspace:*",
"smartsale-lib": "workspace:*",
"smartsale-chains": "workspace:*",
"@sentry/node": "^7.98.0",
"@sentry/node": "^7.100.1",
"lodash": "^4.17.21",
"viem": "latest"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
-- CreateTable
CREATE TABLE "auction_details" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"exact_order_id" BIGINT,
"chain_id" TEXT,
"symbol_auctioning_token" TEXT,
"symbol_bidding_token" TEXT,
"address_auctioning_token" TEXT,
"address_bidding_token" TEXT,
"decimals_auctioning_token" SMALLINT,
"decimals_bidding_token" SMALLINT,
"end_time_timestamp" TIMESTAMP(6),
"order_cancellation_end_date" TIMESTAMP(6),
"starting_time_stamp" TIMESTAMP(6),
"minimum_bidding_amount_per_order" BIGINT,
"min_funding_threshold" BIGINT,
"allow_list_manager" TEXT,
"allow_list_signer" TEXT,
"current_volume" INTEGER,
"current_clearing_order_sell_amount" BIGINT,
"current_clearing_order_buy_amount" BIGINT,
"current_clearing_price" INTEGER,
"current_bidding_amount" BIGINT,
"is_atomic_closure_allowed" BOOLEAN,
"is_private_auction" BOOLEAN,
"interest_score" INTEGER,
"usd_amount_traded" INTEGER,

CONSTRAINT "auction_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "orders" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"auction_id" BIGINT,
"sell_amount" BIGINT,
"buy_amount" BIGINT,
"user_id" BIGINT,
"price" INTEGER,
"volume" BIGINT,
"timestamp" TIMESTAMP(6),

CONSTRAINT "orders_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "users" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"address" TEXT NOT NULL,

CONSTRAINT "users_pkey" PRIMARY KEY ("id","created_at")
);
3 changes: 3 additions & 0 deletions apps/indexer/prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
4 changes: 2 additions & 2 deletions apps/indexer/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ generator client {

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
url = env("DIRECT_URL")
// directUrl = env("DIRECT_URL")
}

/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
Expand Down
11 changes: 0 additions & 11 deletions apps/supabase/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions apps/supabase/README.md

This file was deleted.

159 changes: 0 additions & 159 deletions apps/supabase/config.toml

This file was deleted.

Loading

0 comments on commit c6f852c

Please sign in to comment.