Browse Source

db: Reorder migrations to reflect their relationship

This is dangerous but needed since postgres is not as forgiving about
unsatisfied foreign key constraints even while in a DB transaction.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
3df8ccd3e0
  1. 14
      wallet/db.c

14
wallet/db.c

@ -55,6 +55,13 @@ static struct migration dbmigrations[] = {
", PRIMARY KEY (shachain_id, pos)"
");"),
NULL},
{SQL("CREATE TABLE peers ("
" id INTEGER"
", node_id BLOB UNIQUE" /* pubkey */
", address TEXT"
", PRIMARY KEY (id)"
");"),
NULL},
{SQL("CREATE TABLE channels ("
" id INTEGER," /* chan->id */
" peer_id INTEGER REFERENCES peers(id) ON DELETE CASCADE,"
@ -97,13 +104,6 @@ static struct migration dbmigrations[] = {
" PRIMARY KEY (id)"
");"),
NULL},
{SQL("CREATE TABLE peers ("
" id INTEGER"
", node_id BLOB UNIQUE" /* pubkey */
", address TEXT"
", PRIMARY KEY (id)"
");"),
NULL},
{SQL("CREATE TABLE channel_configs ("
" id INTEGER,"
" dust_limit_satoshis INTEGER,"

Loading…
Cancel
Save