mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-23 14:50:42 +01:00
Enforce unique outpoints for SpendingInfoDb (#1673)
This commit is contained in:
parent
88eb145a37
commit
2ef3f48313
4 changed files with 4 additions and 2 deletions
|
@ -58,7 +58,7 @@ class DbManagementTest extends BitcoinSAsyncTest with EmbeddedPg {
|
|||
dbConfig(ProjectType.Wallet))
|
||||
val walletDbManagement = createWalletDbManagement(walletAppConfig)
|
||||
val result = walletDbManagement.migrate()
|
||||
val expected = if (walletAppConfig.driverName == "postgresql") 2 else 5
|
||||
val expected = if (walletAppConfig.driverName == "postgresql") 3 else 6
|
||||
assert(result == expected)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CREATE UNIQUE INDEX utxo_outpoints ON txo_spending_info (tx_outpoint);
|
|
@ -0,0 +1 @@
|
|||
CREATE UNIQUE INDEX "utxo_outpoints" ON "txo_spending_info" ("tx_outpoint");
|
|
@ -203,7 +203,7 @@ case class SpendingInfoDAO()(implicit
|
|||
extends TableAutoInc[SpendingInfoDb](tag, "txo_spending_info") {
|
||||
|
||||
def outPoint: Rep[TransactionOutPoint] =
|
||||
column("tx_outpoint")
|
||||
column("tx_outpoint", O.Unique)
|
||||
|
||||
def txid: Rep[DoubleSha256DigestBE] = column("txid")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue