mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
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>
This commit is contained in:
parent
e2f7c86271
commit
3df8ccd3e0
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…
Reference in New Issue
Block a user