Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Fix prismas
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Dec 20, 2020
1 parent 0795298 commit 6f44a52
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ cypress/videos
**/.env
**/react-app-env.d.ts
.secret
**/generated
6 changes: 3 additions & 3 deletions modules/router/ops/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ fi
########################################
# Launch it

# echo "Running database migration"
# prisma --version
# prisma migrate up --experimental
echo "Running database migration"
prisma --version
prisma migrate up --experimental

# TODO: this doesn't work with single container mode
# echo "Starting database UI"
Expand Down
4 changes: 4 additions & 0 deletions modules/router/ops/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ module.exports = {
plugins: [
new CopyPlugin({
patterns: [
{
from: path.join(__dirname, "../src/generated"),
to: path.join(__dirname, "../dist/generated"),
},
{
from: path.join(__dirname, "../node_modules/@connext/vector-contracts/dist/pure-evm_bg.wasm"),
to: path.join(__dirname, "../dist/pure-evm_bg.wasm"),
Expand Down
7 changes: 4 additions & 3 deletions modules/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"description": "",
"main": "index.js",
"scripts": {
"build": "rm -rf dist && tsc",
"build": "prisma generate && rm -rf dist && tsc",
"build-bundle": "webpack --config ops/webpack.config.js",
"start": "node dist/index.js",
"test": "ts-mocha --bail --check-leaks --exit --timeout 60000 'src/**/*.spec.ts'"
"start": "prisma migrate up --experimental && node dist/index.js",
"test": "ts-mocha --bail --check-leaks --exit --timeout 60000 'src/**/*.spec.ts'",
"migration:generate": "prisma migrate save --experimental"
},
"author": "",
"license": "ISC",
Expand Down
19 changes: 19 additions & 0 deletions modules/router/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
output = "./src/generated/db-client"
}

datasource db {
provider = ["postgresql", "sqlite"]
url = env("VECTOR_DATABASE_URL")
}

model QueuedUpdate {
id String @id @default(uuid())
type String
channelAddress String
updateData String
status String
context String?
}
2 changes: 1 addition & 1 deletion modules/router/src/services/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NodeParams } from "@connext/vector-types";
import { PrismaClient } from "@prisma/client";

import { PrismaClient } from "../generated/db-client";
import { config } from "../config";

export const RouterUpdateStatus = {
Expand Down
2 changes: 0 additions & 2 deletions modules/server-node/ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ COPY ops ops
COPY schema.prisma schema.prisma
COPY migrations migrations
COPY dist dist
RUN cp -rfT dist/.prisma node_modules/.prisma
RUN cp -rfT dist/@prisma/client node_modules/@prisma/client
ENTRYPOINT ["bash", "ops/entry.sh"]
4 changes: 2 additions & 2 deletions modules/server-node/ops/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ fi
# Launch it

echo "Running database migration"
# prisma --version
# prisma migrate up --experimental
prisma --version
prisma migrate up --experimental

# TODO: this doesn't work with single container mode
# echo "Starting database UI"
Expand Down
16 changes: 6 additions & 10 deletions modules/server-node/ops/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,16 @@ module.exports = {
new CopyPlugin({
patterns: [
{
from: path.join(__dirname, "../schema.prisma"),
to: path.join(__dirname, "../dist/schema.prisma"),
},
{
from: path.join(__dirname, "../../../node_modules/@prisma/client"),
to: path.join(__dirname, "../dist/@prisma/client"),
from: path.join(__dirname, "../node_modules/@connext/vector-contracts/dist/pure-evm_bg.wasm"),
to: path.join(__dirname, "../dist/pure-evm_bg.wasm"),
},
{
from: path.join(__dirname, "../../../node_modules/.prisma/client"),
to: path.join(__dirname, "../dist/.prisma/client"),
from: path.join(__dirname, "../schema.prisma"),
to: path.join(__dirname, "../dist/schema.prisma"),
},
{
from: path.join(__dirname, "../node_modules/@connext/vector-contracts/dist/pure-evm_bg.wasm"),
to: path.join(__dirname, "../dist/pure-evm_bg.wasm"),
from: path.join(__dirname, "../src/generated"),
to: path.join(__dirname, "../dist/generated"),
},
],
}),
Expand Down
11 changes: 1 addition & 10 deletions modules/server-node/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
output = "./src/generated/db-client"
}

datasource db {
Expand Down Expand Up @@ -193,13 +194,3 @@ model NodeIndex {
@@map(name: "node_index")
}

// Router Models
model QueuedUpdate {
id String @id @default(uuid())
type String
channelAddress String
updateData String
status String
context String?
}
10 changes: 5 additions & 5 deletions modules/server-node/src/services/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import {
TransferDispute,
} from "@connext/vector-types";
import { getRandomBytes32, getSignerAddressFromPublicIdentifier } from "@connext/vector-utils";
import { BigNumber } from "@ethersproject/bignumber";
import { TransactionResponse, TransactionReceipt } from "@ethersproject/providers";

import { config } from "../config";
import {
Prisma,
Channel,
Expand All @@ -25,11 +29,7 @@ import {
Balance as BalanceEntity,
Transfer,
OnchainTransaction,
} from "@prisma/client";
import { BigNumber } from "@ethersproject/bignumber";
import { TransactionResponse, TransactionReceipt } from "@ethersproject/providers";

import { config } from "../config";
} from "../generated/db-client";

export interface IServerNodeStore extends IEngineStore {
registerSubscription<T extends EngineEvent>(publicIdentifier: string, event: T, url: string): Promise<void>;
Expand Down

0 comments on commit 6f44a52

Please sign in to comment.