github.com/status-im/status-go@v1.1.0/walletdatabase/migrations/sql/1714670633_add_id_to_multi_transaction_table.up.sql (about) 1 -- Create a copy of multi_transactions table with an additional column for the primary key 2 CREATE TABLE new_table ( 3 id INTEGER PRIMARY KEY, -- Add a new column for the primary key 4 from_address VARCHAR NOT NULL, 5 from_asset VARCHAR NOT NULL, 6 from_amount VARCHAR NOT NULL, 7 to_address VARCHAR NOT NULL, 8 to_asset VARCHAR NOT NULL, 9 type VARCHAR NOT NULL, 10 timestamp UNSIGNED BIGINT NOT NULL, 11 to_amount VARCHAR, 12 from_network_id UNSIGNED BIGINT, 13 to_network_id UNSIGNED BIGINT, 14 cross_tx_id VARCHAR DEFAULT "", 15 from_tx_hash BLOB, 16 to_tx_hash BLOB 17 ) WITHOUT ROWID; 18 19 -- Copy data 20 INSERT INTO new_table (id, from_address, from_asset, from_amount, to_address, to_asset, type, timestamp, to_amount, from_network_id, to_network_id, cross_tx_id, from_tx_hash, to_tx_hash) 21 SELECT rowid, from_address, from_asset, from_amount, to_address, to_asset, type, timestamp, to_amount, from_network_id, to_network_id, cross_tx_id, from_tx_hash, to_tx_hash 22 FROM multi_transactions; 23 24 -- Drop the existing table and rename the new table 25 DROP TABLE multi_transactions; 26 ALTER TABLE new_table RENAME TO multi_transactions;