This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Rahul Sethuram
authored and
Rahul Sethuram
committed
Sep 11, 2020
1 parent
01b547e
commit 1d6e15e
Showing
10 changed files
with
806 additions
and
23 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
122 changes: 122 additions & 0 deletions
122
modules/server-node/migrations/20200911091549-init/README.md
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,122 @@ | ||
# Migration `20200911091549-init` | ||
|
||
This migration has been generated by Rahul Sethuram at 9/11/2020, 11:15:49 AM. | ||
You can check out the [state of the schema](./schema.prisma) after the migration. | ||
|
||
## Database Steps | ||
|
||
```sql | ||
CREATE TABLE "balance" ( | ||
"participant" TEXT NOT NULL, | ||
"assetId" TEXT NOT NULL, | ||
"to" TEXT NOT NULL, | ||
"amount" TEXT NOT NULL, | ||
"lockedValue" TEXT NOT NULL, | ||
"channelAddress" TEXT NOT NULL, | ||
|
||
FOREIGN KEY ("channelAddress") REFERENCES "channel"("channelAddress") ON DELETE CASCADE ON UPDATE CASCADE, | ||
PRIMARY KEY ("participant","channelAddress","assetId") | ||
) | ||
|
||
CREATE TABLE "channel" ( | ||
"channelAddress" TEXT NOT NULL, | ||
"publicIdentifierA" TEXT NOT NULL, | ||
"publicIdentifierB" TEXT NOT NULL, | ||
"participantA" TEXT NOT NULL, | ||
"participantB" TEXT NOT NULL, | ||
"timeout" TEXT NOT NULL, | ||
"nonce" INTEGER NOT NULL, | ||
"latestDepositNonce" INTEGER NOT NULL, | ||
"merkleRoot" TEXT NOT NULL, | ||
"channelFactoryAddress" TEXT NOT NULL, | ||
"vectorChannelMastercopyAddress" TEXT NOT NULL, | ||
"chainId" INTEGER NOT NULL, | ||
"providerUrl" TEXT NOT NULL, | ||
PRIMARY KEY ("channelAddress") | ||
) | ||
|
||
CREATE TABLE "update" ( | ||
"transferId" TEXT NOT NULL, | ||
"assetId" TEXT NOT NULL, | ||
"transferDefinition" TEXT NOT NULL, | ||
"transferTimeout" TEXT NOT NULL, | ||
"transferEncodings" TEXT NOT NULL, | ||
"merkleProofData" TEXT NOT NULL, | ||
"signatureA" TEXT, | ||
"signatureB" TEXT, | ||
"adjudicatorAddress" TEXT NOT NULL, | ||
"channelAddress" TEXT NOT NULL, | ||
|
||
FOREIGN KEY ("channelAddress") REFERENCES "channel"("channelAddress") ON DELETE CASCADE ON UPDATE CASCADE, | ||
PRIMARY KEY ("transferId") | ||
) | ||
|
||
CREATE UNIQUE INDEX "update_channelAddress_unique" ON "update"("channelAddress") | ||
``` | ||
|
||
## Changes | ||
|
||
```diff | ||
diff --git schema.prisma schema.prisma | ||
migration ..20200911091549-init | ||
--- datamodel.dml | ||
+++ datamodel.dml | ||
@@ -1,0 +1,55 @@ | ||
+generator client { | ||
+ provider = "prisma-client-js" | ||
+ binaryTargets = ["native"] | ||
+} | ||
+ | ||
+datasource db { | ||
+ provider = ["sqlite", "postgresql"] | ||
+ url = "***" | ||
+} | ||
+ | ||
+model Balance { | ||
+ @@map(name: "balance") | ||
+ participant String | ||
+ assetId String | ||
+ to String | ||
+ amount String | ||
+ lockedValue String | ||
+ Channel Channel @relation(fields: [channelAddress], references: [channelAddress]) | ||
+ channelAddress String | ||
+ @@id([participant, channelAddress, assetId]) | ||
+} | ||
+ | ||
+model Channel { | ||
+ @@map(name: "channel") | ||
+ channelAddress String @id | ||
+ publicIdentifierA String | ||
+ publicIdentifierB String | ||
+ participantA String | ||
+ participantB String | ||
+ timeout String | ||
+ nonce Int | ||
+ latestDepositNonce Int | ||
+ merkleRoot String | ||
+ balances Balance[] | ||
+ channelFactoryAddress String | ||
+ vectorChannelMastercopyAddress String | ||
+ chainId Int | ||
+ providerUrl String | ||
+ latestUpdate Update? | ||
+} | ||
+ | ||
+model Update { | ||
+ @@map(name: "update") | ||
+ transferId String @id | ||
+ assetId String | ||
+ transferDefinition String | ||
+ transferTimeout String | ||
+ transferEncodings String | ||
+ merkleProofData String | ||
+ signatureA String? | ||
+ signatureB String? | ||
+ adjudicatorAddress String | ||
+ channel Channel @relation(fields: [channelAddress], references: [channelAddress]) | ||
+ channelAddress String | ||
+} | ||
``` | ||
|
||
|
55 changes: 55 additions & 0 deletions
55
modules/server-node/migrations/20200911091549-init/schema.prisma
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,55 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
binaryTargets = ["native"] | ||
} | ||
|
||
datasource db { | ||
provider = ["sqlite", "postgresql"] | ||
url = "***" | ||
} | ||
|
||
model Balance { | ||
@@map(name: "balance") | ||
participant String | ||
assetId String | ||
to String | ||
amount String | ||
lockedValue String | ||
Channel Channel @relation(fields: [channelAddress], references: [channelAddress]) | ||
channelAddress String | ||
@@id([participant, channelAddress, assetId]) | ||
} | ||
|
||
model Channel { | ||
@@map(name: "channel") | ||
channelAddress String @id | ||
publicIdentifierA String | ||
publicIdentifierB String | ||
participantA String | ||
participantB String | ||
timeout String | ||
nonce Int | ||
latestDepositNonce Int | ||
merkleRoot String | ||
balances Balance[] | ||
channelFactoryAddress String | ||
vectorChannelMastercopyAddress String | ||
chainId Int | ||
providerUrl String | ||
latestUpdate Update? | ||
} | ||
|
||
model Update { | ||
@@map(name: "update") | ||
transferId String @id | ||
assetId String | ||
transferDefinition String | ||
transferTimeout String | ||
transferEncodings String | ||
merkleProofData String | ||
signatureA String? | ||
signatureB String? | ||
adjudicatorAddress String | ||
channel Channel @relation(fields: [channelAddress], references: [channelAddress]) | ||
channelAddress String | ||
} |
Oops, something went wrong.