Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wallet] - Revise APIs for wallet authentication
resolves #2403 need knex@^0.95.11 for `setNullable` `dropNullable` knex/knex#1218 (comment)
- Loading branch information
Showing
14 changed files
with
517 additions
and
3,162 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
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
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
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
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
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,42 @@ | ||
const { alterEnumString } = require('../utils') | ||
|
||
const table = 'user' | ||
const crypto_wallet_table = 'crypto_wallet_signature' | ||
|
||
exports.up = async (knex) => { | ||
await knex.schema.table(table, (t) => { | ||
t.string('eth_address').unique() | ||
}) | ||
|
||
await knex.schema | ||
.raw( | ||
alterEnumString(crypto_wallet_table, 'purpose', [ | ||
'airdrop', | ||
'connect', | ||
'signup', | ||
'login', | ||
]) | ||
) | ||
.alterTable(crypto_wallet_table, (t) => { | ||
// at time of generating signing message, the user_id might not be created yet | ||
t.dropForeign('user_id') | ||
t.setNullable('user_id') | ||
t.string('signed_message', 1023).alter() | ||
}) | ||
} | ||
|
||
exports.down = async (knex) => { | ||
await knex.schema | ||
.alterTable(crypto_wallet_table, (t) => { | ||
// t.enu('purpose', ['airdrop', 'connect']).alter() | ||
t.string('signed_message', 255).alter() | ||
t.foreign('user_id').references('id').inTable('user') | ||
}) | ||
.raw( | ||
alterEnumString(crypto_wallet_table, 'purpose', ['airdrop', 'connect']) | ||
) | ||
|
||
await knex.schema.table(table, (t) => { | ||
t.dropColumn('eth_address') | ||
}) | ||
} |
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
Oops, something went wrong.